3 Replies Latest reply on Oct 10, 2007 10:01 AM by Troy Barger

    Asset Number and hostid

      Hi all,

      I wish add Asset Number (read with a vbs script like the hostid command on unix) to my windows servers.

      I wish pass this information to reports and show it in reports.


      Does anyone have any idea how do this?

      I was able only to create an Extended Object to show Asset number from bios.





        • 1. Re: Asset Number and hostid

          I think the best way is to create an ASSET_TAG server property, and then set that using an NSH script that uses the BLCLI to set the value of ASSET_TAG. I believe you can get the asset tag in the WMI. Look at the below code which creates a temp VBScript that queries the WMI for a property (I got this from an old client of mine):








          echo "Found C:

          tmp - ok"


          echo "C:

          tmp not found - creating..."

          mkdir /C/tmp



          cd /C/tmp


          echo "objname = WScript.Arguments(0)\nprop = WScript.Arguments(1)\nset wmi = GetObject(\"winmgmts:\")\nset objectlist = wmi.ExecQuery(\"SELECT \" & prop & \" FROM \" & objname)\nfor each obj in objectlist\n WScript.Echo(obj.Properties_(prop))\nnext\n" > tmp.vbs


          SERVER=`uname -n`


          nexec $SERVER cscript //NoLogo tmp.vbs "$WMI_OBJECT" "$WMI_PROPERTY" | while read VALUE



          VALUE=`echo $VALUE | tr -d '[:cntrl:]'`

          SERVER_KEY=`blcli Server getServerDBKeyByName $SERVER`

          echo "Setting $BL_PROPERTY of $SERVER to $VALUE."

          blcli Server setPropertyValue $SERVER_KEY $BL_PROPERTY $VALUE



          rm /C/tmp/tmp.vbs


          All you need to do is figure out where in the WMI the asset tag is located and pass it into the above script.

          • 2. Re: Asset Number and hostid

            This worked great on most servers, Thanks!

            I do have one scenario that I was wondering if you had any ideas on. I have a growing number of virtual machines in the datacenter and the serial number comes up as "VMware-50 0e d7 03 a0 fa 16 d7-fe d5 da 6b 2d 4e c7 46", whic fails to load in to OM with the following error.


            I'm assuming it's because there are spaces in the $VALUE. Is there a way to allow this value to pass?

            • 3. Re: Asset Number and hostid

              Nevermind, it seems it was a s simple as putting the $VALUE on the blcli line in quotes.