| Written by Diana, on 04-09-2007 02:17 |
| Views |
114  |
|
|
|
PS C:\Users\Admin> help gp -full
NAME Get-ItemProperty
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".
INPUT TYPE
RETURN TYPE Object
----------------- EXAMPLE 1 -----------------
C:\PS>get-itemproperty C:\Windows
This nommand displays information about the C:\Windows directory.
----------------- EXAMPLE 2 -----------------
C:\PS>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 -----------------
C:\PS>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 -----------------
C:\PS>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-List cmdlet 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 Set-ItemProperty Clear-ItemProperty Copy-ItemProperty Move-ItemProperty New-ItemProperty Remove-ItemProperty Rename-ItemProperty about_namespace
Last update: 04-09-2007 02:17
Users' Comments (0)
|
|
|