PowerShell One-Liner: Getting This Computer’s Asset Tag Number


Here’s a gem from an internal email: 

CMD> wmic SystemEnclosure get SMBIOSAssetTag

5551212

If the system has asset tag data added to the BIOS, this is a way to collect it.

Comments (2)

  1. timid says:

    Here's a function for it:

    function Get-AssetTagAndSerialNumber {

       param  ( [string[]]$computerName = @('.') );

       $computerName | % {

           if ($_) {

               Get-WmiObject -ComputerName $_ Win32_SystemEnclosure | Select-Object __Server, SerialNumber, SMBiosAssetTag

           }

       }

    }

  2. Bordwalk2000 says:

    If you want it as a one liner.

    (Get-WmiObject  Win32_SystemEnclosure).SMBiosAssetTag

    or

    (Get-WmiObject -ComputerName Desktop01 Win32_SystemEnclosure).SMBiosAssetTag