header image

COM pt 7–Items pt 2

Posted by: | February 3, 2011 | No Comment |

In part 6 we looked at the drives collection on the FileSystemObject. The Items property was mentioned.

Lets jump back to our Shell object

$shell = New-Object -ComObject "Shell.Application"


if we do a Get-Member

$shell | gm

You will see a method called Namespace.  This allows you to work with the Special Folders. One such special folder contains the cookies on you system.

PS> $shell.Namespace(0x21)

Title                      : Cookies
Application                : System.__ComObject
Parent                     :
ParentFolder               : System.__ComObject
Self                       : System.__ComObject
OfflineStatus              :
HaveToShowWebViewBarricade : False
ShowWebViewBarricade       : False


If we look at the object

$shell.Namespace(0x21) | gm


we will find an Items method.



will dump the information faster than you can read.  The Items method can not be used to dump individual items


We could do something like

$shell.Namespace(0x21).Items() | select Name, ModifyDate


if we want to see all of them.  This can be refined as

$shell.Namespace(0x21).Items() | sort ModifyDate -Descending | select Name, ModifyDate

To discover the number of cookies



In many ways it is similar to the GetEnumerator method on hash tables

under: COM