Skip to main content

How to Set Registry Value in PowerShell

• 4 min read
powershell registry set-itemproperty

Use the Set-ItemProperty cmdlet in PowerShell to set a registry value. This command sets the value of an item for the specified path.

The following method can be used to set a registry value in PowerShell.

Method 1: Set a registry value in PowerShell

$registryPath = "HKLM:\SOFTWARE\SysApp"
Set-ItemProperty -Path $registryPath -Name "MaxSize" -Value 2048

This example sets a registry value for the MaxSize property to 2048 for the specified registry path.

The following example shows how to use this method.

Set a Registry Value in PowerShell

To set a registry value in PowerShell, you can use the Set-ItemProperty cmdlet. This command uses the -Path parameter to specify the registry path, the -Name parameter to specify the registry property, and the -Value parameter to set a new value for the property.

The following example shows how to do this with syntax.

# Specify the registry path
$registryPath = "HKLM:\SOFTWARE\SysApp"

# Set the registry value
Set-ItemProperty -Path $registryPath -Name "MaxSize" -Value 2048

# Get the registry value
Get-ItemProperty -Path $registryPath

In this example, the $registryPath variable holds the path to the registry key. The Set-ItemProperty cmdlet uses the -Path parameter to specify the registry path $registryPath. The -Name parameter specifies the property name MaxSize, and the -Value parameter sets a new value 2048 for the specified property.

You can verify the changes by using the Get-ItemProperty cmdlet to retrieve the registry key properties.

Conclusion

I hope the above article on setting a registry value in PowerShell using the Set-ItemProperty cmdlet is helpful to you.


Core Registry Operations

Registry Query & Retrieval

  • PowerShell Get-ItemProperty - Retrieve registry values
  • PowerShell Get-Item - Get registry paths
  • PowerShell Get-ChildItem - List registry subkeys
  • PowerShell Get Registry Value - Query registry values

Data Processing & Filtering

Control Flow & Logic

Variables & Storage

File & Output Operations

String & Data Manipulation

System Configuration Management

Bulk Operations & Automation

System Administration

  • PowerShell Scope - Registry scope management
  • PowerShell Error Handling - Handle registry errors
  • PowerShell Performance Tuning - Registry optimization

Windows Management

  • PowerShell Remove Environment Variable - Environment variables
  • PowerShell Set Environment Variable - Add environment variables
  • PowerShell Get Environment Variable - Query environment variables

Comprehensive Guides

You can find more topics about Active Directory tools and PowerShell basics on the ActiveDirectoryTools home page.