Set-ItemProperty
Use Set-ItemProperty to change a registry value — or set a property on a file or folder — from PowerShell, without opening regedit.
Documentation: Microsoft Learn — set-itemproperty
Syntax
Try it
PowerShell example · browser support is limited.
Execution scope: The full example below requires PowerShell outside this browser. You can edit this runner to use the supported practice commands; unsupported syntax returns an explanation.
Examples
Change a string registry value
Show reference output
Illustrative output · values vary by environment
(no output; the value is updated)
Create a DWORD value for a setting
Show reference output
Illustrative output · values vary by environment
(creates MyApp key if missing, then sets MaxRetries to 5)
Verify the change you just made
Show reference output
Illustrative output · values vary by environment
MaxRetries : 5
Parameters
Parameter definitions:
-Path— The registry key containing the value, using the HKLM: or HKCU: drive.-Name— The value name to set. If it does not exist, it is created.-Value— The new data for the value.-Type— The registry type: String, ExpandString, Binary, DWord, QWord, MultiString, or Unknown.-Force— Creates missing parent keys and overwrites read-only values.-PassThru— Returns the updated property so you can confirm the change.
Back up the key before you change it
Registry edits take effect immediately and most have no undo button. Before changing a key, export it with reg export HKLM\SOFTWARE\MyApp C:\Backup\myapp.reg or save the current values with Get-ItemProperty to a file. One wrong value in the wrong key can break logon, networking, or an application.
-Type matters. A DWORD and a string that both display as '5' are different data to Windows. If an application ignores your change, the first thing to check is whether the value type matches what the application expects.
Set-ItemProperty creates a missing value but not missing parent keys, unless you add -Force. Without it, writing to a path whose key does not exist yet throws an error instead of creating the key.
Read values back with Get-ItemProperty
List registry keys with Get-ChildItem
Updated 25 October 2026. Browser outputs are fictional; check the installed module help for your environment.
Recap
Set-ItemProperty Use Set-ItemProperty to change a registry value — or set a property on a file or folder — from PowerShell, without opening regedit.
Next: Convertto Securestring