You need to test for the existence of the registry key. New-ItemProperty -Path $registryPath -Name $name -Value $value `Īnd here is the error message that appears when the registry key does not exist: $registryPath = "HKCU:\Software\ScriptingGuys\Scripts" When the registry key property exists, your script works. In your script, you are using the New-ItemProperty cmdlet to attempt to update a registry key property value. Microsoft Scripting Guy, Ed Wilson, is here. Is there something I am not doing? I am including my script so you can see what is going on. The error message says that it cannot find the path because it does not exist. I added the –Force parameter, but it still will not create the registry key. I am using the New-ItemProperty cmdlet, but it fails if the registry key does not exist. Hey, Scripting Guy! I am having a problem trying to update the registry. Summary : Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to update or add a registry key value.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |