Would you like fries with your script ?

I was asked today by our Virtualization team to write a script to support a project that they are about to take on.   The VMWare infrastructure team was looking to upgrade all vmware servers from hardware version 4 to hardware version 7.  The question they had was would it be possible to query the Device Manager from a script and out put the Name of each device and also the Status of the device.  They wanted to be able to do this query against a list of computers before and after the upgrade to assure that the upgrade went successfully.  So I said no problem…. I can script that.

Here is the horrendously long script!  ( With PS-Remoting 😮 for extra bling   )

PS:> Invoke-Command -ComputerName (Get-Content C:\Temp\HWUpgradeIn.txt) -ScriptBlock { Get-WMIObject Win32_PnpEntity | Select ServerName, Name, Status | Out-File c:\Temp\HWUpgradeOut.txt }

This script took me about 5 minutes to come up with.  While I wrote the script the VM team walked back to their desk and started to compile the list of server that they were going to ask me to test with.  They were about to send the email when I walked up and said the script was done. 😮  Just to show them how cool Powershell is…. I showed off a little bit and had one of the guys recreate the script through dictation on his machine. 

 I was in a meeting later in the day and a VM Team member said that I was able to script the process with McDonalds Drive Thru quickness…. So my new tag line is “Do you want fries with that script?”

God Bless and have fun scripting!

Powershell and HP ILO

Today on the job I was tasked with attempting to rewrite some old VBS scripts that pull information from our HP Server Ilo’s.  I did some thinking about how I wanted to approach this and then headed to the interwebs.  A short GOOGLE search later and I found exactly what I was looking for.

Thank you Mike @ Practical Kung Fu Dot Net for the great post!

http://www.practicalkungfu.net/2011/04/using-powershell-to-get-info-out-of-hp.html

Updating Facebook from Powershell!!

I was perusing my Twitter feed the other day and I noticed something interesting, a link to a codeplex project for Powershell Facebook cmdlets.  I headed over to the codeplex page and grabbed them. http://facebookpsmodule.codeplex.com/ Ater downloading the module and installing it I took a quick look under the hood.  John_msft did all the heaving lifting on these cmdlets and did a great job with documentation!

The first thing of note is that according to the documentation the commands currently have to be run through the Powershell ISE.  This is because the New-FBConnection function pops a window that authenticates you to the FB API.

In order to authenticate to the API you simply run the New-FBConnection command.

FBLogin

I noticed in the documentation for the Facebook cmdlets that the only Set or Add event was an Add-Event function that allows the user to create a calendar event in Facebook.

I thought it would be pretty cool to be able to update my status from Powershell.

Let me know what you think 😮

–ScriptWarrior

So here goes… with a slight modification to the Add-Event function that John_MSFT included in the module we come to Set-FBStatus:

<pre>function Set-FBStatus
{

    Param(
        [string][Parameter(ValueFromPipelineByPropertyName=$true,Mandatory=$true)]$Message
        )
    process
    {

        Set-StrictMode -Version 2.0  #Force Version 2
        trap { "Error in Set-FBStatus: $_"; break }

       $parameters = new-object 'system.collections.generic.dictionary[string,object]'  #Create new object
       $parameters["message"] = $Message
       $parameters["access_token"] = $(Get-FBConnection).AccessToken
       $raw = $(Get-FBConnection).Post("me/feed", $parameters)   #Set FB Ojbect to the $raw variable
       Convert-FBJSON $raw   #Call the Convert-FBJSON function from the Facebook cmdlets to send update
    }
}

Set-FBStatus "GOD IS SOOO GOOD!  Praise him today."    #Actual Function Call</pre>

Happy Mothers Day!

What an amazing day.  We spent the morning Praising and Serving the Lord at Beaming Hope Church in St. Petersburg.  Then off to my beautiful Mother-In-Law’s house for an awesome family lunch and a relaxing afternoon.  Now some time for just me and my beautiful wife to enjoy the rest of our evening.

God Bless all you Mothers out there!  Especially those that are fighting for the freedom that we enjoy every day.  You are in our thoughts and prayers.

–ScriptWarrior