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)
  • Re: temperature disque dur
    ... have you a peace of code for mesure temperature of a disque please ... Set colItems = objWMIService.ExecQuery("Select * from ... For Each objItem in colItems ...
    (microsoft.public.scripting.wsh)
  • 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)
  • Re: Where is ootcimv2SecurityMicrosoftVolumeEncryption?
    ... Set colItems = objWMIService.ExecQuery("SELECT * FROM ... For Each objItem in colItems ... If objItem.DriveLetter = strSDL then ...
    (microsoft.public.scripting.vbscript)