Help will empty field entry handling



Hi all,

am using the following code to pull the motherboard serial number from
machines, however some 3rd party oem machines have an empty serial
number field and i would like to have the code report "no serial
number found" if the field is empty of null...

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root
\CIMV2")
Set colItems = objWMIService.ExecQuery( "SELECT * FROM
Win32_BaseBoard",,48)
For Each objItem in colItems
If IsNull(objItem.SerialNumber) Then
MsgBox(objItem.SerialNumber)
End If
Next

and

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root
\CIMV2")
Set colItems = objWMIService.ExecQuery( _
"SELECT * FROM Win32_BaseBoard",,48)
For Each objItem in colItems
Wscript.Echo "-----------------------------------"
Wscript.Echo "Win32_BaseBoard instance"
Wscript.Echo "-----------------------------------"
Wscript.Echo "SerialNumber: " & objItem.SerialNumber
Next

You help would be greatly appreciated.

Cheers,
Daz
.



Relevant Pages

  • Re: How to get System Resources info?
    ... Set colItems = objWMIService.ExecQuery ... For Each objItem in colItems ... > its realted device caption, ...
    (microsoft.public.windowsxp.wmi)
  • Re: use different Roaming Profiles depending on OS
    ... Set colItems = objWMIService.ExecQuery("Select * from ... For Each objItem in colItems ... I have only the opportunity to leave the profil ptah blank or set an profile path. ...
    (microsoft.public.windows.server.active_directory)
  • Help with WMI script reading from TXT file
    ... of servers.txt is not online then strcomputer stays as the sever on line 7 ... For Each objItem in colItems ... Set colItems = objWMIService.ExecQuery("Select * from ...
    (microsoft.public.scripting.vbscript)
  • Help with basic wmi script output file name
    ... I have a script that creates a text file with the output but I need to ... Set colItems = objWMIService.ExecQuery("Select * from ... For Each objItem in colItems ...
    (microsoft.public.windows.server.scripting)
  • Re: Computer Inventory - Win32_PhysicalMemory
    ... two scripts I do indeed receive the correct information (read: ... Set colItems = objWMIService.ExecQuery("SELECT * FROM ... For Each objItem in colItems ...
    (microsoft.public.win32.programmer.wmi)