We have many words to describe those who do the boss's dirty work: minion, henchman, and toadie. My personal favorite is "toadie", as referenced in A Christmas Story. You can tour the house just outside of Cleveland, Ohio. Of course I got my picture taken with the leg lamp.
"So what does 'toadie' have to do with PowerShell?" you ask. Everything. We PowerShell-writing IT pros are like emperors. We sit in the royal cube on the royal throne and make royal decrees like:
From this vantage point we write "toadie" scripts to go do our bidding across the empire. Call them "scripted minions" if you like.
Today we are diving into PowerShell remoting to understand five different methods for commanding our army of minions. We will also examine the protocols and requirements under the hood so we know exactly what we are getting. The information below comes from some testing in my home lab where I captured network traces of each remoting technology to see the ports, protocols, and protections employed between two Windows Server 2008 R2 member servers. The capture file is attached at the end of the article.
Method #1: The Computername Switch
Method #2: WMI
Method #3: PowerShell Remoting Interactively
Method #4: PowerShell Remoting Commands
Method #5: WMI Tunneling Through PowerShell Remoting
Now you have some ideas for collecting data remotely, and there are many variations of the examples listed above. For example, you can pass multiple computer names to the Computername switch:
Get-Process -Computername computer1, computer2, computer3
Or you could pipe a list of computer names into any of these commands:
Get-Content computers.txt | Foreach-Object {Get-Process -Computername $_}
To scale remoting commands out to hundreds of computers explore using Invoke-Command with the switches -AsJob and -ThrottleLimit.
For more information try these lines at the PowerShell console:
Now go unleash your PowerShell minions!
If you would like to have me or another Microsoft PFE visit your company and assist with the ideas presented in this blog post, then contact your Microsoft Premier Technical Account Manager (TAM) for booking information.
For more information about becoming a Microsoft Premier customer email PremSale@microsoft.com. Tell them GoateePFE sent you.