Set ItemProperty - PowerShell


The Set-ItemProperty cmdlet modifies the properties of items in the file system or the registry. It is commonly used to set metadata or configuration values associated with files, folders, or registry keys. This command is particularly useful for customizing item behavior, storing additional information, or managing system settings.


Set-ItemProperty [-Path] <string> -Name <string> -Value <object> [-FromBase64] [-InputType <string>] [-LiteralPath] <string> [-PipelineVariable] <string> [-ErrorVariable] <string> [-ErrorAction] <string> [-WarningAction] <string> [-InformationAction] <string> [-Verbose] [-Debug] [-WhatIf] [-Confirm]


  • -Path: Specifies the path to the item whose property will be modified. Accepts both file and registry paths.
  • -Name: Specifies the name of the property to be modified.
  • -Value: The new value to assign to the specified property. Supports various data types, including strings, numbers, and objects.
  • -FromBase64: Indicates that the value is encoded in Base64 format and should be decoded before being assigned to the property.
  • -InputType: Specifies the input type of the property value. Valid values include String, Date, and Object.
  • -LiteralPath: Treats the value of the -Path parameter as a literal path, preventing PowerShell from interpreting it as a variable.


Example 1: Setting a file’s author property

Set-ItemProperty -Path ".\example.txt" -Name Author -Value "John Doe"

Example 2: Modifying a registry key’s value

Set-ItemProperty -Path "HKCU:\Software\Company\Product" -Name "SettingValue" -Value 100

Example 3: Setting a property using Base64 encoding

$encodedValue = [System.Convert]::ToBase64String("This is a secret value")
Set-ItemProperty -Path ".\secret.txt" -Name "SecretData" -Value $encodedValue -FromBase64

Common Issues

  • Property not found: Ensure that the property name specified in the -Name parameter exists for the item.
  • Access denied: The user may not have sufficient permissions to modify the property. Check the item’s access control list (ACL) or use the -Force parameter.
  • Data type mismatch: Verify that the value you are setting is of the correct data type for the property. Use the -InputType parameter to specify the expected type.


Set-ItemProperty can be combined with other PowerShell commands to automate complex tasks. For instance, it can be used with Get-ChildItem to modify the properties of multiple items simultaneously. Additionally, it can be incorporated into scripts to configure system settings or manage file metadata.

  • Get-ItemProperty: Retrieves the properties of an item.
  • New-ItemProperty: Creates a new property on an item.
  • Remove-ItemProperty: Removes a property from an item.
  • Get-Registry: Retrieves registry keys and values.
  • Set-Registry: Sets registry values.