Search notes:

PowerShell cmdLet Get-ItemProperty

get-itemProperty return a psCustomObject that contains the properties that were requested with get-itemProperty from an item's. Typically, such properties are those of files and directorys (such as lastWriteTime, attributes etc.).
get-itemPropertyValue is related, but returns the value of the property itself, not being wrapped into a psCustomObject.
When accessing the registry, a value is considered to be a property of a registry key (which is the item). Therefore, registry values need to be queried are accessed in PowerShell with get-itemProperty. (See also accessing the registry with PowerShell).

Returned data type

get-itemProperty returns a System.Management.Automation.PSCustomObject object or, in the special case that get-itemProperty is used on a file or directory, without specifying the -name parameter) a System.IO.FileInfo or System.IO.DirectoryInfo object, respectively.
Sometimes, if just the value of registry key is needed, it's easier to use get-itemPropertyValue.
$scriptName = $myInvocation.myCommand.name
$propFile = get-itemProperty $scriptName
$propFile.GetType().FullName
#
#   System.IO.FileInfo

$propFileattr = get-itemProperty $scriptName lastAccessTime
$propFileattr.GetType().FullName
#
#   System.Management.Automation.PSCustomObject


$propDir = get-itemProperty .
$propDir.GetType().FullName
#
#   System.IO.DirectoryInfo


$propRegKey = get-itemProperty 'HKCU:\Control Panel\International'
$propRegKey.GetType().FullName
#
#   System.Management.Automation.PSCustomObject

$propVal = get-itemProperty 'HKCU:\Control Panel\International' sTimeFormat
$propVal.GetType().FullName
#
#   System.Management.Automation.PSCustomObject

$propVal.sTimeFormat.GetType().FullName
#
#   System.String

$val = get-itemPropertyValue 'HKCU:\Control Panel\International' sTimeFormat
$val.GetType().FullName
#
#   System.String
Github repository about-PowerShell, path: /cmdlets/itemProperty/get/data-type.ps1

returning psCustomObject

When get-itemProperty returns a psCustomObject, this object has the (additional) properties: psPath, psParentpath, psChildname, psDrive, psProvider (See also item related properties).
Therefore, if get-itemProperty is used to display a registry value, more information is printed than is probably needed:
PS C:\> get-itemProperty hkcu:\Environment -name PATH
Path         : C:\Users\rene\bin;c:\users\rene\MinGW64\bin;…
PSPath       : Microsoft.PowerShell.Core\Registry::HKEY_CURRENT_USER\Environment
PSParentPath : Microsoft.PowerShell.Core\Registry::HKEY_CURRENT_USER
PSChildName  : Environment
PSDrive      : HKCU
PSProvider   : Microsoft.PowerShell.Core\Registry
So, in order to only get a value, the value name (which becomes a property in the PSCustomObject that is returned) needs to be queried:
PS C:\> (get-itemProperty hkcu:\Environment -name PATH).PATH
C:\Users\rene\bin;c:\users\rene\MinGW64\bin;…

Change file attributes

The following command add the archive file attribute to a given file:
( get-ItemProperty .\some.txt ).attributes += 'archive'

See also

The command parameter -credential.
Powershell command noun: itemProperty

Index