Get-ItemProperty
Additional Resources for Get-ItemProperty |
Listing the Values in a Registry Key http://www.microsoft.com/technet/scriptcenter/topics/msh/cmdlets/get-itemproperty.mspx
|
SYNOPSIS
Retrieves the properties of a specified item.
SYNTAX
Get-ItemProperty [-path] <string[]> [[-name] <string[]>] [-include <string[]>] [-exclude <string[]>] [-filter <string>] [-credential <PSCredential>] [<CommonParameters>]
Get-ItemProperty [-literalPath] <string[]> [[-name] <string[]>] [-include <string[]>] [-exclude <string[]>] [-filter <string>] [-credential <PSCredential>] [<CommonParameters>]
DETAILED DESCRIPTION
Retrieves the properties of a specified item.
PARAMETERS
-path <string[]>
Specifies the path to the item or items.
Required? |
true |
Position? |
1 |
Default value |
current location |
Accept pipeline input? |
true (ByValue, ByPropertyName) |
Accept wildcard characters? |
true |
-name <string[]>
Specifies the name of the property or properties to retrieve.
Required? |
false |
Position? |
2 |
Default value |
String.empty |
Accept pipeline input? |
false |
Accept wildcard characters? |
false |
-include <string[]>
Includes the specified items.
Required? |
false |
Position? |
named |
Default value |
|
Accept pipeline input? |
false |
Accept wildcard characters? |
true |
-exclude <string[]>
Omits the specified items. Wildcards are permitted.
Required? |
false |
Position? |
named |
Default value |
|
Accept pipeline input? |
false |
Accept wildcard characters? |
true |
-filter <string>
Specifies a provider-specific filter.
Required? |
false |
Position? |
named |
Default value |
|
Accept pipeline input? |
false |
Accept wildcard characters? |
false |
-credential <PSCredential>
Specifies the credential used to validate access. If a PSCredential object obtained earlier using get-credential is supplied, it will be used as is. If a user name is supplied, there will be a prompt for a password.
Required? |
false |
Position? |
named |
Default value |
|
Accept pipeline input? |
true (ByPropertyName) |
Accept wildcard characters? |
false |
-literalPath <string[]>
Specifies a path to the item property. The value of -LiteralPath is used exactly as it is typed. No characters are interpreted as wildcards. If the path includes escape characters, enclose it in single quotation marks. Single quotation marks tell Windows PowerShell not to interpret any characters as escape sequences.
Required? |
true |
Position? |
1 |
Default value |
|
Accept pipeline input? |
true (ByPropertyName) |
Accept wildcard characters? |
false |
<CommonParameters>
This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, and -OutVariable. For more information, type, "get-help about_commonparameters".
RETURN TYPE
Object
EXAMPLE 1
get-itemproperty C:\Windows
This command displays information about the C:\Windows directory.
EXAMPLE 2
get-itemproperty C:\Test\Weather.xls | format-list
This command gets the properties of the C:\Test\Weather.xls file. The result is piped to the format-list cmdlet to display the output as a list.
EXAMPLE 3
get-itemproperty -path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion
This command displays the value name and data of each of the registry entries contained in the CurrentVersion registry subkey. Note that the command requires that there is a psdrive named HKLM: that is mapped to the HKEY_LOCAL_MACHINE hive of the registry. A drive with that name and mapping is available in Windows PowerShell by default. Alternatively, the path to this registry subkey can be specified by using the following alternate path that begins with the provider name followed by two colons: Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion.
EXAMPLE 4
get-itemproperty -path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion `
-name "ProgramFilesDir" | format-list ProgramFilesDir
This command displays the value name and data of the ProgramFilesDir registry entry contained in the CurrentVersion registry subkey. The subkey is specified in the Path parameter and the value name of the entry is specified in the Name parameter. Note that the result of the Get-ItemProperty cmdlet is piped to the Format-Listcmdlet to extract information about just the registry entry of interest. By default, Windows PowerShell property information is included in the output of Get-ItemProperty.
RELATED LINKS