Where is it…

So I have been really liking the new Script Browser (http://blogs.technet.com/b/onescript/archive/2014/05/11/what-s-new-in-script-browser-amp-script-analyzer-1-2.aspx) add-on for ISE. Surprisingly I am liking it for the Script Analyzer. Surprising? To be honest I have not been a fan of the recent Scripting Games and all of the judges’ feedback regarding aliases and other commonly used practices. I do see the point but for me, I write the script, make it work and then if I have to make it public I will go through and comment the code to a sickening level. I love what Mr. James Brundage (http://www.start-automating.com/) has brought to the Powershell community but Script Cop angered me 🙂

Since I spend time trying to bestow the strengths of Powershell amongst my colleagues, I am starting to use Script Analyzer to clean up my code before sharing.

The support with the “add-on” has been great as well. With version 1.1 I had encountered some “features” and submitted an email inquiring. The response was quick and a great help.

Since Powershell V3 I have been using the ISE exclusively as my editor and this set of add-ons just makes that experience better.

So what am I posting about? I had the feature installed and working and using the toolset. Then I rebuilt my machine (Bare Metal) to Win7 x64 and of course tried to reinstall the product. Hint, we use roaming profiles. I could net get the install to work, always getting to a point where it wanted a path to a setup.msi file. I tried a few things and was about to send an email to see where I should look in the registry. I wish there was a better code display plugin for wordpress but the details of where I found it…

HKEY_USERS and within my hive it was withing Software\Microsoft\Installer\Products

Once I removed the key from Products, I was able to cleanly install Script Browser.

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.