Managing Internet Cookies

by Jan 16, 2012

Ever wondered what Internet sites store inside cookies when you visit them? This line will dump all cookies:

PS> dir ([system.environment]::GetFolderPath('Cookies'))

Cookies are text files. In older versions of IE, the file name contains the site URL that stored the cookie. To list all cookies from Google, you could try this:

PS> dir ([system.environment]::GetFolderPath('Cookies')) | Where-Object { $_.Name -like '*google*' }

And to actually read the cookie content, simply add Get-Content:

PS> dir ([system.environment]::GetFolderPath('Cookies')) | Where-Object { $_.Name -like '*google*' } | Get-Content

Likewise, by adding Remove-Item you could delete selected or all cookies.

Twitter This Tip!
ReTweet this Tip!