http://msdn.microsoft.com/en-us/library/system.io.fileinfo.aspx - this documents the information available about files
http://technet.microsoft.com/en-us/library/dd347686.aspx - documentation on Get-ChildItem
When we start doing things with files we very quickly find Get-ChildItem
, which is indeed a handy CmdLet and documented at Get-ChildItem. However it took me a while to realise that Get-ChildItem works with any PowerShell Drive that comes from a PowerShell Provider. So, if you start by looking at the providers and see what they support and what drives they expose you can then list the drives and this then tells you what Get-ChildItem can look at, so here are examples from my Windows PC and my Mac.
PS C:\Stuff> Get-PSProvider
Name Capabilities Drives
---- ------------ ------
Alias ShouldProcess {Alias}
Environment ShouldProcess {Env}
FileSystem Filter, ShouldProcess, Credentials {C}
Function ShouldProcess {Function}
Registry ShouldProcess, Transactions {HKLM, HKCU}
Variable ShouldProcess {Variable}
Certificate ShouldProcess {Cert}
WSMan Credentials {WSMan}
PS C:\Stuff> Get-PSDrive
Name Used (GB) Free (GB) Provider Root CurrentLocation
---- --------- --------- -------- ---- ---------------
Alias Alias
C 16.50 33.49 FileSystem C:\ Stuff
Cert Certificate \
Env Environment
Function Function
HKCU Registry HKEY_CURRENT_USER
HKLM Registry HKEY_LOCAL_MACHINE
Variable Variable
WSMan WSMan
PS C:\Stuff> Get-ChildItem
Directory: C:\Stuff
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 09/02/2018 10:03 4196 TestScript.ps1
PS C:\Stuff>
PS /Users/gjlawrence> Get-PSProvider
Name Capabilities Drives
---- ------------ ------
Alias ShouldProcess {Alias}
Environment ShouldProcess {Env}
FileSystem Filter, ShouldProcess, Credentials {/}
Function ShouldProcess {Function}
Variable ShouldProcess {Variable}
PS /Users/gjlawrence> Get-PSDrive
Name Used (GB) Free (GB) Provider Root CurrentLocation
---- --------- --------- -------- ---- ---------------
/ 88.80 376.82 FileSystem / Users/xxxxxxxxxx
Alias Alias
Env Environment
Function Function
Variable Variable
PS /Users/xxxxxxxxxx> Get-ChildItem
Directory: /Users/xxxxxxxxxx
Mode LastWriteTime Length Name
---- ------------- ------ ----
------ 07/12/2017 13:53 259 NexusUpload.sh
------ 13/04/2017 11:30 232 proxy.sh
PS /Users/xxxxxxxxxx>
I was implying that you can list things other than files, so try these commands:Get-ChildItem Env:
Get-ChildItem Cert:\CurrentUser\Root -Recurse
Get-ChildItem Variable:
If you explore the documentation and try things out it is quite amazing what you can find.