To set the value of a registry key, use the Set-ItemProperty cmdlet:
PS > (Get-ItemProperty .).MyProgram c:\temp\MyProgram.exe PS > Set-ItemProperty . MyProgram d:\Lee\tools\MyProgram.exe PS > (Get-ItemProperty .).MyProgram d:\Lee\tools\MyProgram.exe
To remove the value of a registry key, use the Remove-ItemProperty cmdlet:
PS > Remove-ItemProperty . MyProgram PS > (Get-ItemProperty .).MyProgram
In the registry provider, PowerShell treats registry keys as items and key values as properties of those items. To change the value of a key property, use the Set-ItemProperty cmdlet. The Set-ItemProperty cmdlet has the standard alias sp. To remove a key property altogether, use the Remove-ItemProperty cmdlet.
Warning: As always, use caution when changing information in the registry. Deleting or changing the wrong item can easily render your system unbootable.
For more information about the Get-ItemProperty cmdlet, type Get-Help Get-ItemProperty. For information about the Set-ItemProperty and Remove-ItemProperty cmdlets, type Get-Help Set-ItemProperty or Get-Help Remove-ItemProperty, respectively. For more information about the registry provider, type Get-Help Registry.
This introduction to the Windows PowerShell language and scripting environment provides more than 430 task-oriented recipes to help you solve the most complex and pressing problems, and includes more than 100 tried-and-tested scripts that intermediate to advanced system administrators can copy and use immediately. You'll find hands-on tutorials on fundamentals, common tasks, and administrative jobs that you can apply whether you're on a client or server version of Windows.




Help






