Here's a GREAT remote registry "cmdlet"

The Microsoft Scripting Guys'2010 Scripting Games is in full swing, and I've been perusing the entries. One of my favorites so far is in the advanced division, and is designed to set a registry key on one or more remote computers. The author notes, however, that "I'm unhappy with this solution... IMO this script needs a -credential parameter, but I couldn't get  alternate credentials working across platforms( xp,vista,w7)... So I settled on the .net alternative."

It's a great script, because it uses many of the killer new features in PowerShell v2: Comment-based help, script cmdlets (called "advanced functions"), and so on. One new v2 feature the author could have relied on, however, is remoting and the Invoke-Command cmdlet. With that cmdlet, all of the .NET mucking about with the registry could be eliminated: You could simply write a command that used PowerShell's HKCU: or HKLM: drive, transmit that command to the remote computer via Invoke-Command, and have the command execute locally. Invoke-Command supports a -credential parameter, so you'd get alternate credential action, too. True, going that route would entail that remoting be enabled - but in the context of the Scripting Games that's a fine pre-req, and I think shops are going to be enabling remoting pretty broadly before long, anyway.

Invoke-Command is awesome because it eliminates the need to build your own "remote access" solution, or to try and dig up a built-in way to access something remotely. You can simply use whatever command runs locally, and ship it off to the remote computers.

I'm excited to see what else the Scripting Games brings!

Discuss this Blog Entry 3

yorsubs (not verified)
on May 9, 2010
Very interested to see this script, but neither of your links points to it. Please could you update with a link?
Many thanks,
Roy

http://scriptinggames.poshcode.org/code/45.xhtml





on May 14, 2010
Implementing a remoting infrastucture so that only signed scripts can execute is the holy grail of scripting. However the effort to make that happen in both small and large enterprises is the stumbling block. First making managment invest in this to save much more later, a very hard sell because this is deep tech, the don't want to here it. They do want to here "It will be totally secure" and we can save money using it by reducing admin time used. Sounds good? Their response is prove it. How can you prove it if you haven't done it? And so it goes the chicken or the Egg. Which came first. Yes, I know it really isn't that hard to implement in your local test lab or home network. Try doing it for a 5000 or 50000 or even a 100 seat enterprise with politics and wierd network problems and managers that don't get it. The real world folks. Never the less we shall fight the good fight, onward, upward, remote it!



yorsubs (not verified)
on May 9, 2010
Very interested to see this script, but neither of your links points to it. Please could you update with a link?
Many thanks,
Roy

http://scriptinggames.poshcode.org/code/45.xhtml





Please or Register to post comments.

What's PowerShell with a Purpose Blog?

Don Jones demystifies Windows PowerShell.

Blog Archive

Sponsored Introduction Continue on to (or wait seconds) ×