#112686 - 2004-01-28 06:56 PM
Argh!!!! WMIQuery() not working
|
cwhitmore
Starting to like KiXtart
Registered: 2001-05-23
Posts: 102
Loc: Austin, Texas, USA
|
I can't seem to get this code to work even though I've called the WMIQuery UDF. It errors out saying "expected expression on line 33".
$CPUSpeed = WMIQuery("CurrentClockSpeed","Win32_Processor")[0] (i've also tried it without [0]) What gives? Other UDFs are working fine in this script. Carlton.
|
Top
|
|
|
|
#112687 - 2004-01-28 08:07 PM
Re: Argh!!!! WMIQuery() not working
|
Radimus
Moderator
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
have you used other WMIQuery() statements? are they all failing or just this one?
What OS? What kix ver?
|
Top
|
|
|
|
#112688 - 2004-01-28 08:15 PM
Re: Argh!!!! WMIQuery() not working
|
cwhitmore
Starting to like KiXtart
Registered: 2001-05-23
Posts: 102
Loc: Austin, Texas, USA
|
I tried using the examples from the WMIQuery script and they didn't work either so, no I haven't been able to get any WMIQuery statements to work. I'm running wkix32 ver. 4.21 and WMIQuery ver. 2.4 The server is running from is Win2000 SP4 and I'm trying to execute the command on a Win2000 Pro SP4 Dell Dimension L933r PC.
|
Top
|
|
|
|
#112689 - 2004-01-28 08:20 PM
Re: Argh!!!! WMIQuery() not working
|
Radimus
Moderator
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
most wmiqueries require admin on the target machine. are you running this in a logon script?
|
Top
|
|
|
|
#112690 - 2004-01-28 08:23 PM
Re: Argh!!!! WMIQuery() not working
|
cwhitmore
Starting to like KiXtart
Registered: 2001-05-23
Posts: 102
Loc: Austin, Texas, USA
|
Yes I am.
|
Top
|
|
|
|
#112692 - 2004-01-28 08:26 PM
Re: Argh!!!! WMIQuery() not working
|
Radimus
Moderator
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
try something like this to test: Code:
$make = WMIQuery("Manufacturer","Win32_ComputerSystem") ? @error @serror if VarType($make) & 8192 ? "returned an array of " + ubound($make) for each $item in $make ? $item next else ? "not an array or nul returned" endif
|
Top
|
|
|
|
#112693 - 2004-01-28 08:37 PM
Re: Argh!!!! WMIQuery() not working
|
cwhitmore
Starting to like KiXtart
Registered: 2001-05-23
Posts: 102
Loc: Austin, Texas, USA
|
Got the same error "expected expression" when it hit: $make = WMIQuery("Manufacturer","Win32_ComputerSystem")
|
Top
|
|
|
|
#112694 - 2004-01-28 08:39 PM
Re: Argh!!!! WMIQuery() not working
|
Radimus
Moderator
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
then my guess is that you have an open quote somewhere in your code that is 'hiding' the UDF from the script.
|
Top
|
|
|
|
#112696 - 2004-01-28 09:45 PM
Re: Argh!!!! WMIQuery() not working
|
cwhitmore
Starting to like KiXtart
Registered: 2001-05-23
Posts: 102
Loc: Austin, Texas, USA
|
I tried your suggestion of putting the WMIQuery code in my script and it worked! I then recreated another WMIQuery.udf with only the code and no comments and it still does not work with the call statement?
I call it the same way I call the other UDF's: call '@\functions\WMIQuery.udf'
|
Top
|
|
|
|
#112698 - 2004-01-28 10:17 PM
Re: Argh!!!! WMIQuery() not working
|
cwhitmore
Starting to like KiXtart
Registered: 2001-05-23
Posts: 102
Loc: Austin, Texas, USA
|
'@' symbol allows me to point to a directory below the \NETLOGON directory which works fine for the three other UDF's in the script.
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 557 anonymous users online.
|
|
|