PDA

Click to See Complete Forum and Search --> : PhysicalMedia problem in web application


jaybousquet
Dec 21st, 2005, 10:44 AM
Not sure where to put this --- I'll start here.

Hoping to obtain HD serial number in a web application.. I'm using the following code in global.asax.vb :

Dim searcher As New Management.ManagementObjectSearcher("select * from Win32_PhysicalMedia")
Dim wmi_HD As Management.ManagementObject

For Each wmi_HD In searcher.Get()
Response.Write(wmi_HD("SerialNumber"))
Next

searcher = New System.Management.ManagementObjectSearcher("select * from Win32_DiskDrive")
For Each wmi_HD In searcher.Get()
Response.Write(wmi_HD("Model"))
Next

The 2nd loop works fine and iterates through 2 management objects (I have 2 harddrives) - but the 1st loop is never entered. Apparently no objects were returned by the "PhysicalMedia" query. My question is "Why?" Every answer that occurs to me would also seem to necessitate the failure of the 2nd loop as well. Any ideas?

jaybousquet
Dec 21st, 2005, 10:47 AM
PS - Both loops work fine from win forms program