retrieve an IBM servers serial number with Powershell.

We’ve all been there, we’ve a hardware call to log with a vendor, time is of the essence but yet, when they ask… we’ve forgotten to take down the serial number.

Here’s a few quick powershell one liners for getting the serial number using WMI.

I’ve tested this on IBM, and dell hardware but theres no reason it wont work on other systems.

Getting the local serial number:

get-wmiobject win32_bios | select-object serialnumber

Getting a remote serial number:

get-wmiobject win32_bios -computername remotecomputername | select-object serialnumber

I have a full self contained function after the jump should you wish to use it.

 
function get-serialnumber {
<#
    .Synopsis
        Retrieves the machines serial number from the bios.
    .Description
        Queries the local, or optionally remote machines serial number and returns it.
    .Parameter computername
        (Optional) the computername you wish to query.
    .Example
        C:PS> get-serialnumber

        serialnumber
        ------------
        8DZ5X2J

        Description
        -----------
        Retrieves the serial number of the local machine and returns it.

    .Example
        C:PS> get-serialnumber -computername xps

        serialnumber
        ------------
        8DZ5X2J

        Description
        -----------
        Retrieves the serial number on the remote machine and returns it.

    .Notes
        AUTHOR:     Andrew Morgan
        Notes: this is confirmed to work on IBM and Dell Hardware, for other vendors this should work but is untested.

    #>

    param(
    [Parameter(HelpMessage="Server Name, Default is Localhost")]
    [string]$computername=$env:computername)

    Return $serial=get-wmiobject win32_bios -computername $computername |
     select-object serialnumber}

Related Posts

New Module: Creating an RDP file password with Pow... Here's something that is surprisingly tricky to automate in this day and age. Creating a password and storing it in an RDP file. I'm not here to debat...
Dealing with multi numbered versions in powershell... So here's a quick little blog about something i discovered in powershell while googling today. Lots of vendors like to use version numbers includin...
Accurately checking the Citrix PVS “cache in... Citrix Provisioning services "Cache in RAM, overflow to disk", even with it's challenges is something I've always felt was a great idea, hell, I fores...

2 Comments About “retrieve an IBM servers serial number with Powershell.

Leave a Reply