0 Replies Latest reply on May 15, 2018 11:16 PM by coza

    Getting host serial number (asset tag) via Perl

    coza Novice

      I have an existing (large) perl script that collects host and VM hardware information and places it in a internal custom DB.     Since an upgrade to vsphere 6.5 getting the serial number from hosts has broken. 

      We were getting the serial number from the hosts via WSMAN as per below


      my $client = WSMan::StubOps->new(
      path => '/wsman',
      username => $ticket->sessionId,
      password => $ticket->sessionId,
      port => '80',
      address => $hostView->name,
      namespace => 'root/cimv2',
      timeout  => '120'
      OMC => 'http://schema.omc-project.org/wbem/wscim/1/cim-schema/2',
      VMware => 'http://schemas.vmware.com/wbem/wscim/1/cim-schema/2',
      eval {
      foreach ($client->EnumerateInstances(class_name => 'CIM_PhysicalPackage')){
      if ($_->ElementName =~ m/Chassis/i && $_->ChassisTypeDescription !~ m/Blade Enclosure/i) {
      $hostData{serialnumber} = $_->SerialNumber;


      That no longer works and it throws the error:

      Use of uninitialized value in sprintf at C:/Perl/site/lib/SOAP/Lite.pm line 3642

      As far as I can gleam from the small amount of information available WSMAN is no longer available in vsphere 6.5.

      I cannot use the hostsystem view as the serial number for the hosts is not in that output.


      $hostViews = Vim::find_entity_views(view_type => 'HostSystem');


      Is there any other way using Perl to extract the hosts serial number?  I am loafed to rewrite the script in another language due to its size and complexity.