Adele said:
Thanks for the info, but my question is how to get the hard drive serial
number on a REMOTE computer. I can get it on the local computer, but how to
specify I want to get (for example) the server's hard disk serial number?
Sorry, I should learn to read the questions more carefully!!
The following will do what you require (watch for line wrapping) -
Dim sbString As System.Text.StringBuilder = New System.Text.StringBuilder
Dim strServerName As String = "RemoteComputerNameHere!!"
Dim oObjQuery As ObjectQuery = New ObjectQuery("select * from
Win32_Logicaldisk")
Dim mScope As ManagementScope = New ManagementScope("\\" + strServerName
+ "\root\cimv2")
mScope.Connect()
Dim mObjSearch As ManagementObjectSearcher = New
ManagementObjectSearcher(mScope, oObjQuery)
For Each mObj As ManagementObject In mObjSearch.Get
sbString.AppendFormat("Desc={0}, ID={1}, Volname={2}, Serial#={3}" _
, mObj("Description"), mObj("Deviceid"), mObj("VolumeName"),
mObj("VolumeSerialNumber"))
sbString.AppendFormat("" & Microsoft.VisualBasic.Chr(10) & "")
Next
MessageBox.Show(sbString.ToString)
Hope this helps.
ShaneO
There are 10 kinds of people - Those who understand Binary and those who
don't.