Having fun with remote Registry

So I have not been able to really work with Powershell much in my new job.  A recent project had me involved with getting Windows 2008 R2 domain controllers into our infrastructure.  All of that was pretty standard.  There is one little setting that seems to get our security guys into interrogation mode.  That little icon on Windows 2008R2 and Windows 7 that shows if you have internet connectivity or not… It can be turned off via Group Policy easy enough but there is not much Powershell going on in this office so…

First example I showed was how to use the CLI to make the change the value locally using:

set-itemproperty hklm:\system\currentcontrolset\services\nlasvc\parameters\internet -Name 'EnableActiveProbing' -value 0 -type dword

I then wrote a script that when logged onto a server we could run to check the current setting and update it if necessay. 
This of course led to a challenge “can you show what all of our 2008R2 servers are set for”… As I said before there is not much Powershell in this shop so Remoting is not an option.  That is when I rediscovered a module that I had not used in over a year… PSRemoteRegistry I was quickly able to give a brief instruction on powershell modules and then show a quick example of how to remotely check the value and then set it appropriately if necessary:

get-regdword -Computer computername -Hive LocalMachine -Key system\currentcontrolset\services\nlasvc\parameters\internet -Value EnableActiveProbing
set-regdword -Computer computername -Hive LocalMachine -Key system\currentcontrolset\services\nlasvc\parameters\internet -Value EnableActiveProbing -Data 0

 Wala… Now the computer just needs to be rebooted and the Security folks won’t see these machines trying to test for internet connectivity.   Now I did have one machine that was my test machine that was not cooperative, matter of fact a valid set-itemproperty statement would actually cause it to duplicate the key but there was another issue on that machine at the time and I didn’t take the time to resolve what appeared to be a one-off case.