PowerShell Genie

Set-ItemProperty

Use Set-ItemProperty to change a registry value — or set a property on a file or folder — from PowerShell, without opening regedit.

Command 4 min read PowerShell 7 on Windows

Documentation: Microsoft Learn — set-itemproperty

Syntax

1PS> Set-ItemProperty [-Path] <String> [-Name] <String> [-Value] <Object> [-Type <RegistryValueKind>] [-Force] [-PassThru] [<CommonParameters>]

Try it

Windows PowerShell

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.

Interactive simulation · fictional data

Examples

Change a string registry value

1PS> Set-ItemProperty -Path 'HKCU:\Control Panel\Desktop' -Name Wallpaper -Value 'C:\Wallpapers\blue.jpg'
Show reference output

Illustrative output · values vary by environment

(no output; the value is updated)

Create a DWORD value for a setting

1PS> Set-ItemProperty -Path 'HKLM:\SOFTWARE\MyApp' -Name MaxRetries -Value 5 -Type DWord -Force
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

1PS> Get-ItemProperty -Path 'HKLM:\SOFTWARE\MyApp' -Name MaxRetries
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.

Microsoft Learn — set-itemproperty

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
Genie guideSet-ItemProperty

Set-ItemProperty writes registry values: change a Windows setting, set an application option, or create a value that does not exist yet. Learn the value types, the -Force behaviour, and the backup-before-you-change habit. The console below is pre-loaded — run it, then change a value and run it again.