VMware {code} Community
marsu1983
Contributor
Contributor

Change VM's serial number

Hi guys,

I have to deploy an automated VMware infrastructure. To made this, Y use SDK library with perl to attack my ESXis servers and create VMs. I need to use the serial number of VMs to identify servers into the Realease Management tool and then deploy. This way work pretty well with hardware servers but, i met a problem about VM's serial number. Indeed it is composed by default with VMware-uuid. But UUID is split and space are inserted which make me crazy to manage.

So my question is, first is to possible to get a serial number without space characters and next how to change with the SDK library ?

Many thanks for your help.

0 Kudos
6 Replies
stumpr
Virtuoso
Virtuoso

It would be trivial to reformat the UUID without spaces and hyphens via Perl (of if you're using the CLI tools, awk/sed/powercli, etc).  Is there something more complicated with your UUID format in your CMDB? 

You could also generate your own UUID values with an appropriate library, then add them into the VMX settings of the VirtualMachines during creation time.  Then you'd have UUIDs in the format you prefer.

Reuben Stump | http://www.virtuin.com | @ReubenStump
0 Kudos
marsu1983
Contributor
Contributor

Problem is when i bring machine power on, uuid.bios change in vmx file with spaces. I just replace my uuid.bios like (uuid generated form a generator):

uuid.bios = "5d8cd632-9dfb-4011-94d3-3c781c8bfdca"

Then booting my vm change the uuid.bios like this:

uuid.bios =  "56 4d 2b 7b aa 58 03 4a-d8 e3 ab 71 b4 41 bc ae"

0 Kudos
stumpr
Virtuoso
Virtuoso

That happens, yes.  I meant you can add your own custom UUID field:

myCompany.uuid = "..."

Then you can access it from the API tooling later.  Is the problem that you are using non-VMware script tooling to get the UUID from the VM afterwards?

Reuben Stump | http://www.virtuin.com | @ReubenStump
0 Kudos
marsu1983
Contributor
Contributor

Thanks for your answer, i test by adding this line to my vmx file and my VM:

myCompany.uuid = "toto"

It doesn't change anything. When i'm trying to get the serial number with a tool like dmidecode for exemple, it's always the same resulat i had something like:

VMWARE-56 4d 2b 7b aa 58 03 4a-d8 e3 ab 71 b4 41 bc ae

Problem is i'm using a tool that import the serial number of servers (hard and virtual) based on an agent on the server which run dmidecode (dmidecode -s chassis-serial-number). And we have problems if we have serials with spaces, so 'im looking for a solution to change this in order to delete spaces.

0 Kudos
marsu1983
Contributor
Contributor

I maybe have a solution, but i don't know how to do. i explain, as said before i'm using dmidecode to get serial number of servers. Command i'm doing is

dmidecode -s chassis-serial-number

and return is "none". So i need to find variable in vmx file which can give access to set this. If you have any idea ?

0 Kudos
stumpr
Virtuoso
Virtuoso

If you're using dmidecode, then you need the uuid set.  But, even with the hyphen format, usually dmidecode handles it -

uuid.location = "56 4d 1f bc b8 82 0a af-fe c4 2b a6 e7 04 0e a5"

dmidecode -t system

# dmidecode 2.11

SMBIOS 2.4 present.

Handle 0x0001, DMI type 1, 27 bytes

System Information

  Manufacturer: VMware, Inc.

  Product Name: VMware Virtual Platform

  Version: None

  Serial Number: VMware-56 4d 1f bc b8 82 0a af-fe c4 2b a6 e7 04 0e a5

  UUID: 564D1FBC-B882-0AAF-FEC4-2BA6E7040EA5

  Wake-up Type: Power Switch

  SKU Number: Not Specified

  Family: Not Specified

Notice the UUID matches the uuid.location.  Have you tried dmidecode -s system-uuid?  That number (with a little character manipulation) should get you results.

Reuben Stump | http://www.virtuin.com | @ReubenStump
0 Kudos