Showing posts with label get-childitem. Show all posts
Showing posts with label get-childitem. Show all posts

Tuesday, January 20, 2009

access the certification store

PS> get-childitem cert:


Location : CurrentUser
StoreNames : {UserDS, AuthRoot, CA, Trust...}

Location : LocalMachine
StoreNames : {AuthRoot, CA, Trust, Disallowed...}


PS> get-childitem cert:\CurrentUser\CA


It shows 'Thumbprint', 'Subject' headers.

The Subject header has 'CN=Root Agency', MS WHC, VeriSign Class 2 etc.

Monday, January 19, 2009

get all items

[] to get all items within a folder

PS> Get-ChildItem -Force C:\

[] to to list everything on the C drive

PS> Get-ChildItem -Force C:\ -Recurse

[] to find all executables within the Program Files folder that were last modified after October 1, 2005 and which are neither smaller than 1 megabyte nor larger than 10 megabytes

PS> Get-ChildItem -Path $env:ProgramFiles -Recurse -Include *.exe
| Where-Object -FilterScript {($_.LastWriteTime -gt "2005-10-01") -and ($_.Length -ge 1m) -and ($_.Length -le 10m)}

Sunday, January 18, 2009

find all files with specified criteria

[] to find all files in the Windows directory with the suffix .log and exactly five characters in the base name

PS> get-childitem -path c:\lindows\?????.log


Directory: Microsoft.PowerShell.Core\FileSystem::C:\lindows


Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 2008-Nov-30 12:41 PM 5868 ocgen.log
-a--- 2008-Dec-10 8:56 AM 194 setup.log

[] to find all files that begin with the letter 'c' in the Windows directory

PS> get-childitem -path c:\windows\system32\c*

[] to find all files whose names begin with 'u' or 'z'

PS> get-childitem -path c:\windows\system32\[uz]*

[] to find 32-bit Windows compatibility DLLs excluding Windows 95 and 16-bit type in the System32 folder

PS> get-childitem -path c:\windows\system32\w*32*.dll -exclude *[9516]*

[] to restrict the items to those that are in the Windows folder with names end with '*.dll', excluding those names from 'a to y'

PS> get-childitem -path c:\lindows -Include *.dll -recurse -exclude [a-y]*.dll

reveal R-O, S, H -attribute files

In Vista, to display hidden items

PS> get-childitem -path c:\users\administrator -force