Table of contents
ISE
TOC
Collapse the table of content
Expand the table of content

Get-ItemPropertyValue

JuanPablo Jofre|Last Updated: 12/17/2016
|
3 Contributors

SYNOPSIS

Gets the value for one or more properties of a specified item.

SYNTAX

Path (Default)

Get-ItemPropertyValue [[-Path] <String[]>] [-Name] <String[]> [-Filter <String>] [-Include <String[]>]
 [-Exclude <String[]>] [-Credential <PSCredential>] [-UseTransaction] [<CommonParameters>]

LiteralPath

Get-ItemPropertyValue -LiteralPath <String[]> [-Name] <String[]> [-Filter <String>] [-Include <String[]>]
 [-Exclude <String[]>] [-Credential <PSCredential>] [-UseTransaction] [<CommonParameters>]

DESCRIPTION

The Get-ItemPropertyValue gets the current value for a property that you specify when you use the Name parameter, located in a path that you specify with either the Path or LiteralPath parameters.

EXAMPLES

Example 1: Get the value of the ProductID property

PS C:\> Get-ItemPropertyValue HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion -Name ProductID
94253-50000-11141-AA785

This command gets the value of the ProductID property of the \SOFTWARE\Microsoft\Windows NT\CurrentVersion object in the Windows Registry provider.

Example 2: Get the last write time of a file or folder

PS C:\> Get-ItemPropertyValue -Path C:\Users\Test\Documents\ModuleToAssembly -Name LastWriteTime
Wednesday, September 3, 2014 2:53:22 PM

This command gets the value of the LastWriteTime property, or the last time a file or folder was changed, from the C:\Users\Test\Documents\ModuleToAssembly folder, working in the FileSystem provider.

Example 3: Get multiple property values of a file or folder

PS C:\> Get-ItemPropertyValue -Path C:\Users\Test\Documents\ModuleToAssembly -Name LastWriteTime,CreationTime,Root





















Wednesday, September 3, 2014 2:53:22 PM
Wednesday, September 3, 2014 2:53:10 PM

Name              : C:\ 
Parent            : 
Exists            : True
Root              : C:\ 
FullName          : C:\ 
Extension         : 
CreationTime      : 9/1/2014 4:59:45 AM
CreationTimeUtc   : 9/1/2014 11:59:45 AM
LastAccessTime    : 9/27/2014 5:22:02 PM
LastAccessTimeUtc : 9/28/2014 12:22:02 AM
LastWriteTime     : 9/27/2014 5:22:02 PM
LastWriteTimeUtc  : 9/28/2014 12:22:02 AM
Attributes        : Hidden, System, Directory
BaseName          : C:\ 
Target            : 
LinkType          : 
Mode              : d--hs-

This command gets the values of the LastWriteTime, CreationTime, and Root properties of a folder. The property values are returned in the order in which you specified the property names.

PARAMETERS

-Credential

Specifies a user account that has permission to perform this action. The default is the current user. Type a user name, such as User01 or Domain01\User01, or enter a PSCredential object, such as one generated by the Get-Credential cmdlet. If you type a user name, you are prompted for a password. This parameter is not supported by any providers that are installed with Windows PowerShell.

Type: PSCredential
Parameter Sets: (All)
Aliases: 

Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-Exclude

Specifies, as a string array, an item or items that this cmdlet excludes from the operation.

Type: String[]
Parameter Sets: (All)
Aliases: 

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Filter

Specifies a filter in the provider's format or language. The value of this parameter qualifies the Path parameter. The syntax of the filter, including the use of wildcard characters, depends on the provider. Filters are more efficient than other parameters, because the provider applies them when the cmdlet gets the objects rather than having Windows PowerShell filter the objects after they are retrieved.

Type: String
Parameter Sets: (All)
Aliases: 

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Include

Specifies, as a string array, an item or items that this cmdlet includes in the operation.

Type: String[]
Parameter Sets: (All)
Aliases: 

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-LiteralPath

Specifies a path to the item property. In contrast to the Path parameter, 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.

Type: String[]
Parameter Sets: LiteralPath
Aliases: PSPath

Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-Name

Specifies the name of the property or properties to retrieve.

Type: String[]
Parameter Sets: (All)
Aliases: PSProperty

Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Path

Specifies the path to the item or items.

Type: String[]
Parameter Sets: Path
Aliases: 

Required: False
Position: 0
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False

-UseTransaction

Includes the command in the active transaction. This parameter is valid only when a transaction is in progress. For more information, see Includes the command in the active transaction. This parameter is valid only when a transaction is in progress. For more information, see

Type: SwitchParameter
Parameter Sets: (All)
Aliases: usetx

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).

INPUTS

System.String

You can pipe a string that contains a path to this cmdlet.

OUTPUTS

System.Boolean, System.String, System.DateTime

This cmdlet returns an object for each item property value that it gets. The object type depends on the property value that is retrieved. For example, in a file system drive, the cmdlet might return a file or folder.

NOTES

  • This cmdlet is designed to work with the data exposed by any provider. To list the providers available in your session, run the Get-PSProvider cmdlet. For more information, see about_Providers.

Get-ItemProperty

Clear-ItemProperty

Copy-ItemProperty

Move-ItemProperty

New-ItemProperty

Remove-ItemProperty

Rename-ItemProperty

Set-ItemProperty

Get-PSProvider

© 2017 Microsoft