PowerShell:- Update a Registry Key value.

Recently we had a request to update a whole stack of servers registry keys. With PowerShell this is easy to do.

In the first step you need to set the location of where you want to work. In this case it was HKLM:\SOFTWARE\Location – Location being where you want to update the key. The command for this would be:

  • Set-Location “HKLM:\SOFTWARE\Location” (note the inverted commas)

Then we need to get the property values of the path, you can do this running this command:

  • Get-ItemProperty -Path .

This lists all the keys.

Now we can finally change the value of the key. To do this you can run the following command:

  • Set-ItemProperty -Path . -Name “Name of key” -Value “Value details”

There you have it, simple enough to update.

Hope it helps.

You may also like...

1 Response

  1. George says:

    Actual entry: Set-Location “HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced”

    PS returns: Set-Location : Cannot find path ‘C:\WINDOWS\system32\HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced’ because it does not exist.

Leave a Reply