You are here:

WindowsManagement.com > PowerShell > PowerShell 1.0 > Get-ChildItem
ActiveXperts Network Monitor 2019 proactively manages network servers, devices, databases and more.

Get-ChildItem - PowerShell 1.0

Microsoft Windows PowerShell is a command-line shell and scripting tool based on the Microsoft .NET Framework. It is designed for system administrators, engineers and developers to control and automate the administration of Windows and applications.

More than hundred command-line tools (so called "cmdlets") can be used to perform system administration tasks and Windows Management Instrumentation (WMI). These cmdlets are easy to use, with standard naming conventions and common parameters, and standard tools for piping, sorting, filtering, and formatting data and objects.

Get-ChildItem


Description
Back up your Hyper-V VMs Easy & Fast. 100% built for Hyper-V. Free for 2 VMs, forever.

Usage


Options
-path string
       The paths to the items from which content is to be retrieved.
       Wildcards are permitted.

   -literalPath string
       Like Path above, only the value is used exactly as typed.
       No characters are interpreted as wildcards. If the path includes any
       escape characters then enclose the path in single quotation marks.
        
   -include string
       Include only the specified items from the Path. e.g. "May*"
        
   -exclude string
       Omit the specified items from the Path e.g. "*SS64*"
       This parameter does not work properly in this cmdlet.
        
   -filter string
       A filter in the provider's format or language. 
       The exact syntax of the filter (wildcard support etc) depends on the provider.
       Filters are more efficient than -include/-exclude, because the provider
       applies the filter when retrieving the objects, rather than having 
       PowerShell filter the objects after they are retrieved.
	   
   -name 
       Retrieve only the names of the items.
       This is useful when piping the names of the child items to another command.
        
   -recurse 
       Get the items plus all child items of the location(s).
       Only for paths that point to a container such as C:\Windows or C:\Windows\*
       A path such as *.txt will not have any child items.

   -force
       Override restrictions that prevent the command from succeeding, apart
       from security settings. e.g. Force will create file path directories 
       or override a files read-only attribute, but will not change file permissions.
        
   -codeSigningCert 
       Retrieve only certificates that have code signing authority. 
       Valid only when using the Windows PowerShell Certificate provider.
       For more info, type "get-help about_provider" and "get-help about_signing".

   CommonParameters:
       -Verbose, -Debug,-ErrorAction,-ErrorVariable, -OutVariable.

Example(s)
Get the child items in the current location:

PS C:\>get-childitem

List all the .XLS files in C:\Work and all sub-folders:

PS C:\>get-childitem C:\Work\ -Include *.xls -Recurse

List all the files owned by BillG:

PS C:\>get-childitem C:\Work\ -recurse | get-acl | where {$_.Owner -match "BillG"}

Measure the size of a folder:

Get-ChildItem C:\Work\ -Recurse -Force | Measure-Object -property length -sum

Get all the certificates in the certificate store that have a code-signing authority:

PS C:\>get-childitem cert:\. -recurse -codesigningcert

You can also run gci against a file share on a remote machine using a UNC path.