VBS - How to get HD serial number
![Vbs Get Monitor Serial Number Vbs Get Monitor Serial Number](/uploads/1/2/6/2/126264295/581278862.gif)
Script Get ※ Download: Get monitor serial number remotely vbs retrieve monitor serial number from remote location The class is.
VBS - How to get HD serial number
Hi there,
Here is my vbs code to read HD serial number. The WMI return only a unintelligible byte value. So I've written a conversion function.
----------------------------------------
strComputer = '.'
Set objWMIService = GetObject('winmgmts:{impersonationLevel=impersonate}!' & strComputer & 'rootcimv2')
str = '
Set colItems = objWMIService.ExecQuery('SELECT * FROM Win32_PhysicalMedia')
For Each objItem In colItems
str = objItem.SerialNumber & vbCrlf & vbCrlf
msgbox( 'Serial Number : ' & ConvertSN(Str))
next
Function ConvertSN(Str)
DIM Hxstr
DIM i
Hxstr = '
for i=0 to (Len(str)/4)-2
Hxstr = Hxstr & chr('&H' & mid(str,4*i+3,2)) & chr('&H' & mid(str,4*i+1,2))
next
Hxstr = trim(Hxstr)
ConvertSN = Hxstr
end function
------------------------------------------
Here is my vbs code to read HD serial number. The WMI return only a unintelligible byte value. So I've written a conversion function.
----------------------------------------
strComputer = '.'
Set objWMIService = GetObject('winmgmts:{impersonationLevel=impersonate}!' & strComputer & 'rootcimv2')
str = '
Set colItems = objWMIService.ExecQuery('SELECT * FROM Win32_PhysicalMedia')
For Each objItem In colItems
str = objItem.SerialNumber & vbCrlf & vbCrlf
msgbox( 'Serial Number : ' & ConvertSN(Str))
next
Function ConvertSN(Str)
DIM Hxstr
DIM i
Hxstr = '
for i=0 to (Len(str)/4)-2
Hxstr = Hxstr & chr('&H' & mid(str,4*i+3,2)) & chr('&H' & mid(str,4*i+1,2))
next
Hxstr = trim(Hxstr)
ConvertSN = Hxstr
end function
------------------------------------------
- this is awesome... how can I get this txt file info into a custom inventory rule?
- I created a custom inventory field:
Display Name (title): Monitor Serial Number
Publisher (Vendor): My Company (replace this with yours)
Supported OS: Windows - I picked all Windows I saw, except Windows 2000. Because I have very few of those left < 1%. If you need Win2k support, the script would need to be modified and also the custom inventory rule.
Custom Inventory Rule:
FileExists(C:WindowsTempKACE-Monitor-info.txt) AND ShellCommandTextReturn(cmd /c type C:WindowsTempKACE-Monitor-info.txt)
For the script I put it as an offline kscript.- I agree this is awesome... but we've only had our kbox for a few months and i havent learned to do scripts before today (the auditor is here for a month :( uggg) Is there a comprehensive import vbs scripts to kace script somewhere?
I am able to run the above script from a pc (not from kace console) and get the resulting text file to show in kace custom inventory field.
I just cant figure out how to combine the above script with the:
'The following is an example of the XML structure for an appliance script:
<?xml version='1.0' encoding='utf-8' ?>
<kbots xmlns='http://kace.com/Kbots.xsd'>
<kbot>
<config name='name=' type='policy' version='version=' description='description='>
<execute disconnected='false' logged_off='false'>
</execute>
</config>
<compliance>
</compliance>
</kbot>
</kbots>'
requirement from the Creating and editing scripts help section. How can do?
- After seeing the script in action I see some potential drawbacks:
The monitor sn will not be unique in the custom inventory fields, because if a computer monitor was not uninstalled on a PC before removal, it will still show up in the registry.
Also, the monitor may show up on a lot of computers registry if it was on the master sysprep image.
I plan to test out Extron EDID manager to see if it reads from the monitor EDID instead of the windows registry.
http://www.extron.com/product/software.aspx?id=edidmanager