Get-ItemPropertyValue

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

Syntax
      Get-ItemPropertyValue { [-path] string[] | [-literalPath] string[] }
         [[-name] string[]] [-include string[]] [-exclude string[]]
            [-filter string] [-credential PSCredential]
                 [CommonParameters]

Key
   -path string
       The path(s) to the items. 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.

   -name string
       The name(s) of the property to retrieve.
       n.b. -name '(default)' will retrieve all properties, not just the default value.

   -include string
       Include only the specified items from the Path. e.g. "May*"
       this only works when the path includes a wildcard character.
        
   -exclude string
       Omit the specified items from the Path e.g. "*SS64*"
       this only works when the path includes a wildcard character.
        
   -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.
 
   -credential PSCredential
       Use a credential to validate access to the file. Credential represents
       a user-name, such as "User01" or "Domain01\User01", or a PSCredential
       object, such as the one retrieved by using the Get-Credential cmdlet.
       If you type a user name, you will be prompted for a password.

   -UseTransaction
       Include the command in the active transaction.

Standard Aliases for Get-ItemProperty: sp

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

Examples

Get the value of the ProductID property:

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

Get the last write time of a file or folder:

PS C:\> Get-ItemPropertyValue -Path 'C:\Program Files\WindowsPowerShell' -Name LastWriteTime
19 June 2022 01:16:49

Get multiple property values of a file or folder:

PS C:\> Get-ItemPropertyValue -Path 'C:\Program Files\PowerShell' -Name LastWriteTime, CreationTime, exists
23 March 2021 6:53:13 AM
14 August 2017 1:42:40 PM
True

“A man who knows the price of everything and the value of nothing” ~ Oscar Wilde

Related PowerShell Cmdlets

error: Specified cast is not valid.(registry) workaround is to only read a specific key ( -name ).
Get-ChildItem - Get child items (contents of a folder or registry key).
Clear-ItemProperty - Remove the property value from a property.
Copy-ItemProperty - Copy a property along with its value.
Get-ItemProperty - Retrieve the properties of an object.
Get-Item - Get a file object or get a registry (or other namespace) object.
Move-ItemProperty - Move a property from one location to another.
New-ItemProperty - Set a new property of an item at a location.
Set-ItemProperty - Set a property at the specified location to a specified value.
Remove-ItemProperty - Remove a property and its value from the location.
Rename-ItemProperty - Renames a property at its location.


 
Copyright © 1999-2026 SS64.com
Some rights reserved