Managing Internet Cookies

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!


Posted Jan 16 2012, 06:00 AM by ps1
Concentrated Tech NSoftware Dell Compellent Sponsored by Idera and Concentrated Tech and NSoftware and Dell Compellent
Copyright 2011 PowerShell.com. All rights reserved.