PowerShell Logo Small

Get-Item



This is the built-in help made by Microsoft for the command 'Get-Item', in PowerShell version 5 - as retrieved from Windows version 'Microsoft Windows Server 2012 R2 Standard' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.

SYNOPSIS

Gets the item at the specified location.

SYNTAX


Get-Item [-Path] <String[]> [-Credential [<PSCredential>]] [-Exclude [<String[]>]] [-Filter [<String>]] [-Force] [-Include [<String[]>]] [-InformationAction
{SilentlyContinue | Stop | Continue | Inquire | Ignore | Suspend}] [-InformationVariable [<System.String>]] [-Stream [<System.String[]>]] [-UseTransaction
[<SwitchParameter>]] [<CommonParameters>]
Get-Item [-Credential [<PSCredential>]] [-Exclude [<String[]>]] [-Filter [<String>]] [-Force] [-Include [<String[]>]] [-InformationAction {SilentlyContinue | Stop | Continue
| Inquire | Ignore | Suspend}] [-InformationVariable [<System.String>]] [-Stream [<System.String[]>]] -LiteralPath <String[]> [-UseTransaction [<SwitchParameter>]]
[<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The Get-Item cmdlet gets the item at the specified location. It does not get the contents of the item at the location unless you use a wildcard character (*) to request all
the contents of the item.


The Get-Item cmdlet is used by Windows PowerShell providers to enable you to navigate through different types of data stores.



<

RELATED LINKS

Online Version: http://go.microsoft.com/fwlink/p/?linkid=290495
Clear-Item
Copy-Item
Invoke-Item
Move-Item
New-Item
Remove-Item
Rename-Item
Set-Item
about_Providers

REMARKS

<

Examples


-------------------------- EXAMPLE 1 --------------------------

PS C:\>get-item .

Directory: C:\
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 7/26/2006 10:01 AM ps-test



This command gets the current directory. The dot (.) represents the item at the current location (not its contents).










-------------------------- EXAMPLE 2 --------------------------

PS C:\>get-item *

Directory: C:\ps-test
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 7/26/2006 9:29 AM Logs
d---- 7/26/2006 9:26 AM Recs
-a--- 7/26/2006 9:28 AM 80 date.csv
-a--- 7/26/2006 10:01 AM 30 filenoext
-a--- 7/26/2006 9:30 AM 11472 process.doc
-a--- 7/14/2006 10:47 AM 30 test.txt



This command gets all the items in the current directory. The wildcard character (*) represents all the contents of the current item.










-------------------------- EXAMPLE 3 --------------------------

PS C:\>get-item C:\



This command gets the current directory of the C: drive. The object that is retrieved represents only the directory, not its contents.










-------------------------- EXAMPLE 4 --------------------------

PS C:\>get-item C:\*



This command gets the items in the C: drive. The wildcard character (*) represents all the items in the container, not just the container.

In Windows PowerShell, use a single asterisk (*) to get contents, instead of the traditional "*.*". The format is interpreted literally, so "*.*" would not retrieve
directories or file names without a dot.










-------------------------- EXAMPLE 5 --------------------------

PS C:\>(get-item C:\Windows).LastAccessTime



This command gets the LastAccessTime property of the C:\Windows directory. LastAccessTime is just one property of file system directories. To see all of the properties of a
directory, type "(Get-Item <directory-name>) | Get-Member".










-------------------------- EXAMPLE 6 --------------------------

PS C:\>get-item hklm:\software\microsoft\powershell\1\shellids\microsoft.powershell\*



This command shows the contents of the Microsoft.PowerShell registry key. You can use Get-Item with the Windows PowerShell Registry provider to get registry keys and
subkeys, but you must use Get-ItemProperty to get the registry values and data.










-------------------------- EXAMPLE 7 --------------------------

PS C:\>get-item c:\Windows\*.* -exclude w*



This command gets items in the Windows directory with names that include a dot (.), but do not begin with w*. This command works only when the path includes a wildcard
character (*) to specify the contents of the item.