February 13th, 2014

PowerTip: Create New Item in Registry with PowerShell

Doctor Scripto
Scripter

Summary: Use Windows PowerShell to create an entry in the Windows registry structure.

Hey, Scripting Guy! Question How do I create an entry in the Windows registry with Windows PowerShell?

Hey, Scripting Guy! Answer Use the New-ItemProperty cmdlet to add the information you need.
          For example, the following command makes a new name called StartMeUp with a value of Runit.exe 
          under HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run:

$RegistryPath=”HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\Run\"

$Name=”StartMeUp”

$Value=”Runit.exe”

NEW-ITEMPROPERTY $RegistryPath -Name $Name -Value $Value

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

0 comments

Discussion are closed.

Feedback