Get Dell Service Tag using PowerShell

A popular script on this blog uses the Win32_SystemEnclosure WMI class to get the Dell Service Tag from Dell computers [see Getting Dell Service Tag using WMI].

Powershell’s Get-WmiObject cmdlet makes it a one-liner. You can also use it to get the serial number from systems made by other manufacturers.:

Get-WmiObject win32_SystemEnclosure | select serialnumber

To list all properties exposed by the Win32_SystemEnclosure class:

Get-WmiObject win32_SystemEnclosure | fl *

Update 7/13/2022:

As @Ripstone commented, Get-WmiObject is superseded by the new Get-CimInstance cmdlet based on the Common Information Model (CIM). You can use it to get the same Win32_SystemEnclosure class and the Dell Service Tag or serial number.

Get-CimInstance win32_SystemEnclosure | select serialnumber

For more information about differences between WMI and CIM, see Get-CIMInstance Vs Get-WMIObject: What’s The Difference?

Written by

Bharat Suneja

11 Comments

  1. Ronald

    Seems like the following works too:

    Get-WMIObject -Class Win32_Bios

    Added advantage is it works on my IBM Blades too whereas the other does not…

  2. Anonymous

    gwmi win32_bios

    works too

  3. cheap computers

    Dell has been remarkably open to date in allowing users to publicly vent their spleen on its blog.

  4. Mark

    So how do you get the serial without all of the extra text. I have thus far:

    gwmi win32_bios | select serialnumber

    But that returns:

    serialnumber
    ——————-
    [The actual serial number]

    How can I omit the first two lines being returned?

  5. EvilEmuOfDoom

    “How can I omit the first two lines being returned?”

    You want to use the “-expand” flag for Select-Object. Try this:
    gwmi win32_bios | select -expand serialnumber

  6. Robert

    How can you get the service tags for multiple servers at the same time?
    Thanks,

    1. Nathan

      gwmi win32_bios -computer servername | select -expand serialnumber

  7. Ripstone

    WMI has been deprecated since PowerShell v3. This command should work going forward:

    Get-CimInstance win32_SystemEnclosure | select serialnumber

  8. antonio

    Sharing a one liner to get the info from multiple computers, using the info i learned here:)

    Invoke-Command -ComputerName svr1,svr2,svr3,svr4 -ScriptBlock {Get-WmiObject win32_SystemEnclosure | select serialnumber}

  9. haq

    I need the script to find computer/host name if we know the service tag within a network not locally.

Leave a Comment

Your email address will not be published. Required fields are marked *