Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


null value using WMI

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,59700
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> null value using WMI
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 null value using WMI - 5/1/2008 12:53:30 AM   
  o2flow

 

Posts: 7
Score: 0
Joined: 1/24/2008
Status: offline
Ok so I am new to vbs so go easy on me. I put this little script together to grab every object from an OU, ping it, then attempt to grab every admin account from the machine by looking at the SID. I've processed about 500? machines and every time it quits on the same machine with this error

test4.vbs (25, 3) (null): 0x80041017

Now does that mean on line 25 it is trying to grab the objAccount from colAccounts and objAccount is returning a null value? On the machine in question, there *were* two AD accounts in the Admin group that had been removed from AD (only the SID was showing). I removed those accounts from the group and machine and the script still fails on the same machine.


      
 
 
Post #: 1
 
 RE: null value using WMI - 5/1/2008 12:57:19 AM   
  ebgreen


Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
I would imagine that you are on the right track. So I would suggest validating the collection before you try to iterate through it.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to o2flow)
 
 
Post #: 2
 
 RE: null value using WMI - 5/1/2008 1:04:39 AM   
  o2flow

 

Posts: 7
Score: 0
Joined: 1/24/2008
Status: offline
Is there a possibility the Win32 class is not available in Windows 2000 but is in XP? Perhaps the Select statement is failing?

(in reply to ebgreen)
 
 
Post #: 3
 
 RE: null value using WMI - 5/1/2008 1:08:26 AM   
  ebgreen


Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
That is possible. Connect to a 2K machine via the WBEM test tool and see if the class is there.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to o2flow)
 
 
Post #: 4
 
 RE: null value using WMI - 5/1/2008 1:17:54 AM   
  dm_4ever


Posts: 2254
Score: 32
Joined: 6/29/2006
From: Orange County, California
Status: offline
According to the SDK, Win32_UserAccount should be available on Win2k

quote:


Client Requires Windows Vista, Windows XP, Windows 2000 Professional, or Windows NT Workstation 4.0 SP4 and later.
Server Requires Windows Server "Longhorn", Windows Server 2003, Windows 2000 Server, or Windows NT Server 4.0 SP4 and later.


Definitely try connecting to this workstation like ebgreen suggested...maybe even run the script locally...it could be that WMI is corrupted on that one workstation.

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to o2flow)
 
 
Post #: 5
 
 RE: null value using WMI - 5/1/2008 1:18:18 AM   
  o2flow

 

Posts: 7
Score: 0
Joined: 1/24/2008
Status: offline
Yes, it is Windows 2000. Can you show me an example of how to validate return values from Select statements?

(in reply to ebgreen)
 
 
Post #: 6
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> null value using WMI 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