Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


WMI Query to determine if Object is a Computer?

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> WMI Query to determine if Object is a Computer?
  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 >>
 WMI Query to determine if Object is a Computer? - 3/1/2005 2:16:56 AM   
  aek

 

Posts: 29
Score: 0
Joined: 2/24/2005
From:
Status: offline
I want to write a WMI query that would
1) Ping the object. (Ping should be silent, not with the command window popping up)
If Ping is successful
2) Check to see if the object is a computer, printer or router?
Based on the results, generates
3)IP Address of object, hostname
4) Finally write in a log file - That I can take care of.

I am new to WMI any help would be great.
 
 
Post #: 1
 
 Re: WMI Query to determine if Object is a Computer? - 3/1/2005 2:22:13 AM   
  Snipah


Posts: 1341
Score: 6
Joined: 11/1/2004
From: Netherlands
Status: offline
I use this (for you to start with)

      


(in reply to aek)
 
 
Post #: 2
 
 Re: WMI Query to determine if Object is a Computer? - 3/1/2005 3:04:04 AM   
  aek

 

Posts: 29
Score: 0
Joined: 2/24/2005
From:
Status: offline
Thanks.

I am assuming that "item.SystemType" will identify the object whether it is a Printer, Computer or Router.

Does "item.Status" only identify if object is on the network or not. Then in that case, will I still need to ping the object to check if it is active on the network or not?

Eg. My machine is on the network but it might be turned off. If I run the query on that object, will it still return enabled..coz it is on the network...even though it is off.

Just want to make sure that would I still need to add ping query or "item.Status" should suffice.

Thanks.

(in reply to aek)
 
 
Post #: 3
 
 Re: WMI Query to determine if Object is a Computer? - 3/1/2005 11:50:47 AM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
You do need to ping it (or use any other methods you can think of to determine whether it is active on the network or not).

However, if the remote computer is offline, System object will return empty (or null). So you can use that for your cause as well. Simply add an IF statemenet to determine the object type.

(in reply to aek)
 
 
Post #: 4
 
 Re: WMI Query to determine if Object is a Computer? - 3/2/2005 12:13:01 AM   
  aek

 

Posts: 29
Score: 0
Joined: 2/24/2005
From:
Status: offline
Thanks Guys.
You are the best.

(in reply to aek)
 
 
Post #: 5
 
 Re: WMI Query to determine if Object is a Computer? - 3/2/2005 1:04:52 AM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
No problem.

(in reply to aek)
 
 
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 >> WMI Query to determine if Object is a Computer? 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