How To Set Registry Values With PowerShell

Josh King, our resident videoper is back to school us again on creating registry values with PowerShell. PowerShell can do a lot and by using the New-ItemProperty cmdlet as a weapon, Josh is able to slay all of those todos that require changing mass quantities of registry values.

In this step. We only to be setting registry values with powershell to do this use the new item property. Commandlet specify the path to the key under which you want to define these values the name of your value. The property type and the value itself in this example. I'm creating a screencasts value under the techsnips key and my current user hive of set the property type to dword or 32 bit integer and the value itself is 5. However, when I run this. I get an error message because that key techsnips doesn't yet exist. So first I need to go ahead and create that key and then I can define my new registry value. You can also define you registry values without specifying a property type and powerShell will match the type you're supplying via the value and match. That to a appropriate property type within the registry so I can provide a string such as registry values. Or I can provide an integer. And then if I look at the contents of their key using get item property. I can see that both screencasts from the previous example and published had been created those integers. Where is current snap has been created as a string if you want to see it the default value for a key for example. I want to see it. The default value for my techsnips key to the URL for the techsnips website. You can do this using new item property, however, the name is default in parentheses. Also. If you want to update a value note that if you use new item property. You'll get an error message because that value already exists you can, however use? Set item property and note that property type isn't valid on this commandlet. When I run thus that property has been updated, but dubya. We're that you can overwrite the property type for a property when updating so powerShell will accept the string tin and this will change from an integer value to a string value. Finally, if you need to see it registry values for the local machine hive. You do need to run as an administrator. And if you aren't you get an error message telling you that that registry access is not allowed. That's been setting registry values with powershell. Thank you for watching