#71627 - 2002-11-18 12:14 AM
Re: ryan, about your question in wmiquery()
|
Ryan
Fresh Scripter
Registered: 2001-11-11
Posts: 42
Loc: the Netherlands
|
Thanks for your reply! And yes this works.
But back to this query:
WMIQuery("DNSHostName", "Win32_NetworkAdapterConfiguration", @WkSta, "IPEnabled", "TRUE")
WMIQuery("IPAddress", "Win32_NetworkAdapterConfiguration", @WkSta, "IPEnabled", "TRUE")
It returns the hostname, but doesn't return the IPAddress!
Greetz
|
|
Top
|
|
|
|
#71629 - 2002-11-18 12:22 AM
Re: ryan, about your question in wmiquery()
|
Ryan
Fresh Scripter
Registered: 2001-11-11
Posts: 42
Loc: the Netherlands
|
Windows 2000 Professional UK SP2
|
|
Top
|
|
|
|
#71631 - 2002-11-18 12:45 AM
Re: ryan, about your question in wmiquery()
|
Ryan
Fresh Scripter
Registered: 2001-11-11
Posts: 42
Loc: the Netherlands
|
I use this script to pull info from other network clients with WMI installed.
I still think it has something to do with Execute().
code:
$=execute("$$value = $$objInstance.$what")
I can't put ' quotes around the second part in this case.
Let's see what others may find.
Thanx anyway, Ryan
|
|
Top
|
|
|
|
#71633 - 2002-11-17 03:46 PM
Re: ryan, about your question in wmiquery()
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
I think that the issue is that "IPAddress" is "string array" and not a standard string.
quote: IPAddress Data type: string array Access type: Read-only
Array of all of the IP addresses associated with the current network adapter.
Example: "155.34.22.0"
I don't see where The UDF handles such a data type. I agree that the statement you reference is most likely the issue. I think that the "$$objInstance.$what" needs to be evaluted as to variable type and further processed if necessary. (wild-ass guess) [ 17. November 2002, 15:59: Message edited by: Howard Bullock ]
|
|
Top
|
|
|
|
#71634 - 2002-11-17 03:57 PM
Re: ryan, about your question in wmiquery()
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
This modified WMIQuery (WMIQuery2) addresses your need. code:
FUNCTION WMIQuery2($what,$from,optional $computer,optional $where, optional $x) dim $strQuery, $objEnumerator, $value if not $computer $computer="@WKSTA" endif $strQuery = "Select $what From $from" if $where and $x $strQuery = $strQuery + " Where $where = '$x'" endif $SystemSet = GetObject("winmgmts:{impersonationLevel=impersonate}!//$computer") if @error exit 1 return endif $objEnumerator = $SystemSet.ExecQuery($strQuery) For Each $objInstance in $objEnumerator If @Error = 0 and $objInstance <> "" $=execute("$$value = $$objInstance.$what") Select case VarType($value) = 8204 for each $x in $value $WMIQuery2="$x"+"|"+"$WMIQuery2" next case VarType($value) = 8 $WMIQuery2="$value"+"|"+"$WMIQuery2" case 1 $WMIQuery2 = "Unhandled data type returned: " + VarTypeName($value) + "(" + VarType($value) + ")" EndSelect Endif Next $WMIQuery2=left($WMIQuery2,len($WMIQuery2)-1) exit @error ENDFUNCTION
[ 17. November 2002, 17:31: Message edited by: Howard Bullock ]
|
|
Top
|
|
|
|
#71635 - 2002-11-18 03:56 PM
Re: ryan, about your question in wmiquery()
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
good job Howard... I had wanted to get around to doing that...
Did you want to post it seperately, or have me update the original?
code:
$ip=wmiquery2("IPAddress", "Win32_NetworkAdapterConfiguration",@wksta,"IPEnabled","True") $sn=wmiquery2("IPSubnet", "Win32_NetworkAdapterConfiguration",@wksta,"IPEnabled","True") $gw=wmiquery2("DefaultIPGateway","Win32_NetworkAdapterConfiguration",@wksta,"IPEnabled","True") $ma=wmiquery2("MACAddress", "Win32_NetworkAdapterConfiguration",@wksta,"IPEnabled","True")
? $ip ? $sn ? $gw ? $ma
[ 18. November 2002, 15:57: Message edited by: Radimus ]
|
|
Top
|
|
|
|
#71636 - 2002-11-18 03:59 PM
Re: ryan, about your question in wmiquery()
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
I think it would be better to have you update the original. That way there is only one UDF meaning less confusion on the part of users.
|
|
Top
|
|
|
|
#71637 - 2002-11-19 02:13 AM
Re: ryan, about your question in wmiquery()
|
Ryan
Fresh Scripter
Registered: 2001-11-11
Posts: 42
Loc: the Netherlands
|
This Howard is good! Excellent!
I'm so glad with the solution. I couldn't find the real problem.
Thanx y'all, 4 helping each other out.
Ryan
|
|
Top
|
|
|
|
#71638 - 2002-11-19 02:45 AM
Re: ryan, about your question in wmiquery()
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
ryan, glad that I could help.
The board is dead tonight. Do you have any other problem(s) you need help resolving?
|
|
Top
|
|
|
|
#71639 - 2002-11-19 04:30 AM
Re: ryan, about your question in wmiquery()
|
Ryan
Fresh Scripter
Registered: 2001-11-11
Posts: 42
Loc: the Netherlands
|
Hey Howard,
I'm trying 2 find a way, 2 automate a dial-up connection. All i found till now is the rasphone options and the dialup-script options. Works great but doesn't disconnect the line. But since I found KiXtart & COM match great..., yeah u know were i'm heading 2! Searched the net, but nothing yet!
Well hope u can help me, or at least have some ideas!
Groetjes Ryan
|
|
Top
|
|
|
|
#71640 - 2002-11-19 04:40 AM
Re: ryan, about your question in wmiquery()
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Sorry, don't have any experience in that area, but I will be looking for anything that may help.
|
|
Top
|
|
|
|
#71641 - 2002-11-19 06:18 PM
Re: ryan, about your question in wmiquery()
|
Chris S.
MM club member
   
Registered: 2002-03-18
Posts: 2368
Loc: Earth
|
If you're using rasphone to initiate the connection, you can use rasphone to disconnect it...
code:
shell 'rasphone.exe -h "Name of Dial-up Connection"'
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 2220 anonymous users online.
|
|
|