Author Archives: mintroini

How to install RetroPie from a Mac or Linux computer with the command line.

If you don’t know already, The Raspberry Pi is a tiny, credit card sized computer that can do anything from Home Automation, to Game Emulation. At $35, it’s hard not to pick one up and get nerdy with it. So I decided to give in to my inner nerd and give one a try.

After getting the Pi, the first thing I needed to do was put an OS on it! With so many choices on what to run, Raspbian (a plain Debian based OS optimized for the RPi), Raspbmc (a Media Center image), RetroPie (a game emulator), I decided that I wanted to run RetroPie. In order to accomplish this, I followed a few simple steps to load the downloaded image from my Mac to the Raspberry Pi’s HDD (a micro SD card).

Check it out!

Advertisements

How to run Powershell Commands on Remote Servers

So you have to run a command, or a set of commands on multiple servers and you want to save yourself the trouble of logging into each and every one of them to do it. This is something that comes up almost on  daily basis for most Administrators and usually it’s something that seems innocuous enough, but when you need to do it to 10-20-50 servers it can become an all day task. We want to avoid that, we want to avoid it like the plague; let’s get the simple stuff out of the way and move on to the more interesting things to play with.

Say we need to get Disk Information for a few servers so that we can build a report off of it.

First thing’s first, we need a list of servers to work with. There are a few ways to get a list, but lets keep it simple for now; let’s just create an array and give it a name.

$Servers = "Server1", "Server2", "Server3"

Next, let’s write out the command that we’re going to want to run on each of the servers.

$ScriptBlock = { Get-WmiObject -Class Win32_LogicalDisk }

Putting the command in a variable will allow us to have cleaner code, and make it easier to manipulate when we want to expand what we’re looking for.

Now we need to loop through each server so that our command runs on each one. We could use a “Foreach” loop to do that, but that could take some time since the command would run only 1 server at a time. To speed things up a little, we’re going to use Invoke-Command instead. Since Invoke-Command can run a maximum of 32 concurrent connections we’ll want to take full advantage of that.

Invoke-Command -ComputerName $Servers -ScriptBlock | Format-Table

This is a very basic example of Invoke-Command, but it shows us what it’s capable…and I’m just scratching the surface of it here.

This is the full script:

#Server List
$Servers = "Server1", "Server2", "Server3"

#Get all Disk Info from remote servers
$ScriptBlock = { Get-WmiObject -Class Win32_LogicalDisk }

#Run the command on all servers
Invoke-Command -ComputerName $Servers -ScriptBlock $ScriptBlock | Format-Table

Next time I’ll go through how to utilize Invoke-Command to create an IIS Site on server farm.

Tagged , , ,