How to retrieve Azure VM Serial Number using Azure PowerShell

Minnick, Gary A 1 Reputation point
2020-11-18T13:48:23.983+00:00

I need to retrieve the Azure VM serial number from a server using Azure PowerShell. I need the same number that appears when you enter the command below in Windows.

(Get-WmiObject -class Win32_bios -namespace root\CIMV2).serialnumber

I tried using Get-AzVM and found VMID and ID but they are not the correct numbers. And I do not want to remotely query the OS since I want to use this for both Windows and Linux VMs. I want to pull from the Azure VM information if possible.

Thanks!!

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
9,014 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. KarishmaTiwari-MSFT 20,772 Reputation points Microsoft Employee Moderator
    2020-11-20T19:02:07.817+00:00

    Thanks for the information. From my knowledge, the serial number is related to bios. We could only get it from OS level. You could run PowerShell command from Azure Portal to get the serial number as long as the agent is ready.

    1. Check whether agent is ready or not.

    41532-image.png
    2. Run command on Portal

    41533-image.png
    3. Get the serial number
    41534-image.png

    1 person found this answer helpful.
    0 comments No comments

  2. Khurram Rahim 1,851 Reputation points Volunteer Moderator
    2020-11-18T14:21:14.617+00:00

    Use this command to get your windows serial number:

    wmic bios get serial number

    hope answer the question if issue resolve accept answer please


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.