KS-Soft. Network Management Solutions
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister    ProfileProfile    Log inLog in 

WMI returning arrays

 
Post new topic   Reply to topic    KS-Soft Forum Index -> Library
View previous topic :: View next topic  
Author Message
grussell



Joined: 21 Jan 2010
Posts: 36

PostPosted: Sat Jan 30, 2010 12:36 pm    Post subject: WMI returning arrays Reply with quote

Hi - I'm trying to use WMI to obtain the IP address using

select IPAddress FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = 'TRUE' AND Index=1

But an array is returned - how do I pull the IP address from this in AHM?

Many thanks,

Gavin.
Back to top
View user's profile Send private message
KS-Soft



Joined: 03 Apr 2002
Posts: 12791
Location: USA

PostPosted: Sat Jan 30, 2010 3:47 pm    Post subject: Reply with quote

There is no such option. HostMonitor shows just one value, it does not publish arrays.

Regards
Alex
Back to top
View user's profile Send private message Visit poster's website
KS-Soft



Joined: 03 Apr 2002
Posts: 12791
Location: USA

PostPosted: Sat Jan 30, 2010 3:48 pm    Post subject: Reply with quote

Please use this forum when you have some useful script, application etc that can be useful for everyone.
E.g. you can create VBScript to request WMI arrays then publish this script in this forum.

Regards
Alex
Back to top
View user's profile Send private message Visit poster's website
grussell



Joined: 21 Jan 2010
Posts: 36

PostPosted: Mon Feb 01, 2010 6:13 am    Post subject: Shell Script to get single WMI value from array Reply with quote

Option Explicit

const statusAlive = "scriptRes:Host is alive:"
const statusDead = "scriptRes:No answer:"
const statusUnknown = "scriptRes:Unknown:"
const statusNotResolved = "scriptRes:Unknown host:"
const statusOk = "scriptRes:Ok:"
const statusBad = "scriptRes:Bad:"
const statusBadContents = "scriptRes:Bad contents:"

'---- entry point ----
dim objWMIService, wbemObjectSet,wbemObject, strIPAddresses
Set objWMIService = GetObject("winmgmts:")
Set wbemObjectSet = objWMIService.ExecQuery("SELECT * FROM " & _
"Win32_NetworkAdapterConfiguration WHERE Index=1 AND IPEnabled = True")
For Each wbemObject In wbemObjectSet

If Not IsNull(wbemObject.IPAddress) Then
strIPAddresses = Join(wbemObject.IPAddress)
Else
strIPAddresses = ""
End If
wscript.stdout.write statusOk
WScript.StdOut.Write strIPAddresses
next
Back to top
View user's profile Send private message
KS-Soft



Joined: 03 Apr 2002
Posts: 12791
Location: USA

PostPosted: Mon Feb 01, 2010 4:10 pm    Post subject: Reply with quote

Thank you

Regards
Alex
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    KS-Soft Forum Index -> Library All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

KS-Soft Forum Index