myITforum.com Community Forum myITforum.com Community Forum

Home  Forums  Blogs  Live Support chat  Search Articles  Wiki  FAQ  Email Lists  Register  Login  My Profile  Inbox  Address Book  My Subscription  My Forums 

Photo Gallery  Member List  Search  Calendars  FAQ  Ticket List  Log Out

All Forums RSS Feed Subscription:


  


query excluding empty or null results

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
  Printable Version
All Forums >> [Scripting Technologies] >> Windows Management Instrumentation >> query excluding empty or null results Page: [1]
Login
Message << Older Topic   Newer Topic >>
query excluding empty or null results - 10/9/2008 4:23:47 PM   
scooper759

 

Posts: 3
Score: 0
Joined: 1/11/2006
Status: offline
This snippet is intended to create a collect of network adapters not microsoft and contain a macaddress yet, it seems to ignor the macaddress query parameter by listing adapters without macaddres values. Vartype shows the empty macaddress values as type1 (vbNull).  Anyone have an idea how to get a list of adapters only with macaddress values. I've tried other null and empty string options in the query, I'm going nuts. Thanks

Set oLocator = CreateObject("WbemScripting.SWbemLocator")
Set oService = oLocator.ConnectServer(sServer,sNameSpace,sUserName,sPassword)
set oInstances = oService.ExecQuery("SELECT * from Win32_NetworkAdapter where _
Manufacturer <> 'Microsoft' AND MACAddress <> " & vbNull & "")

wscript.Echo oInstances.Count
For each oAdapter in oInstances
wscript.Echo oAdapter.deviceid, oAdapter.Manufacturer, Vartype(oAdapter.MacAddress)
Next

Thanks
Post #: 1
RE: query excluding empty or null results - 10/13/2008 5:26:36 PM   
scooper759

 

Posts: 3
Score: 0
Joined: 1/11/2006
Status: offline
Not a WMI issue but a scripting problem. There is a differance between vbNull and NULL so replacing vbNull with NULL resolves this.

(in reply to scooper759)
Post #: 2
Page:   [1]
All Forums >> [Scripting Technologies] >> Windows Management Instrumentation >> query excluding empty or null results Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts



  
Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

0.234