I'm a relatively inexperienced coder and I've been running into an issue with getting the physical disk serial number remotely via a VBScript.
Currently I'm using the default script in Scriptomatic V2, by the Scripting Guys. I'm running it from a 2003 Server and trying to get info from Win2000 and WinXP SP2/SP3 systems. I've seen from a couple tutorials that the WMI class recommended is Win32_PhysicalMedia.
Including the useful bits:
On Error Resume Next
Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20
arrComputers = Array("STN_XP","STN_2000")
For Each strComputer In arrComputers
WScript.Echo
WScript.Echo "=========================================="
WScript.Echo "Computer: " & strComputer
WScript.Echo "=========================================="
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_PhysicalMedia", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)
For Each objItem In colItems
'(Removed a couple from the code, just showing the useful ones)
WScript.Echo "Model: " & objItem.Model
WScript.Echo "Name: " & objItem.Name
WScript.Echo "SerialNumber: " & objItem.SerialNumber
WScript.Echo "Tag: " & objItem.Tag
WScript.Echo
Next
Next
Now the output I get is below: Note this is the exact output from running the script with all calls; no data is returned beyond the objItem.Tag value:
==========================================
Computer: STN_XP
==========================================
Capacity:
Caption:
CleanerMedia:
CreationClassName:
Description:
HotSwappable:
Manufacturer:
MediaDescription:
MediaType:
Model:
Name:
OtherIdentifyingInfo:
PartNumber:
PoweredOn:
Removable:
Replaceable:
SerialNumber:
SKU:
Status:
Tag: \\.\PHYSICALDRIVE0
Version:
WriteProtectOn:
==========================================
Computer: STN_2000
==========================================
All computers are connected to a domain, I'm logged in to the primary admin account. Using some of the other WMI libraries, I get data, and on one specific computer so far I've received a serial number (and tag, but nothing else). I've read up on this being an issue for Vista, where you are required to run in admin mode. This shouldn't be an issue here, due to the OSes in use. Anyone know what might be wrong?
As a follow-up question, does anyone know how to get the Serial Number from a 2000 station?
Thanks in advance for any help you can give me.