cwhitmore
(Starting to like KiXtart)
2004-01-28 06:56 PM
Argh!!!! WMIQuery() not working

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.



Radimus
(KiX Supporter)
2004-01-28 08:07 PM
Re: Argh!!!! WMIQuery() not working

have you used other WMIQuery() statements?
are they all failing or just this one?

What OS?
What kix ver?


cwhitmore
(Starting to like KiXtart)
2004-01-28 08:15 PM
Re: Argh!!!! WMIQuery() not working

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.


Radimus
(KiX Supporter)
2004-01-28 08:20 PM
Re: Argh!!!! WMIQuery() not working

most wmiqueries require admin on the target machine. are you running this in a logon script?



cwhitmore
(Starting to like KiXtart)
2004-01-28 08:23 PM
Re: Argh!!!! WMIQuery() not working

Yes I am.

LonkeroAdministrator
(KiX Master Guru)
2004-01-28 08:25 PM
Re: Argh!!!! WMIQuery() not working

it would be cool if you would provide us the info what is line 33.

Radimus
(KiX Supporter)
2004-01-28 08:26 PM
Re: Argh!!!! WMIQuery() not working



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



cwhitmore
(Starting to like KiXtart)
2004-01-28 08:37 PM
Re: Argh!!!! WMIQuery() not working

Got the same error "expected expression" when it hit:
$make = WMIQuery("Manufacturer","Win32_ComputerSystem")



Radimus
(KiX Supporter)
2004-01-28 08:39 PM
Re: Argh!!!! WMIQuery() not working

then my guess is that you have an open quote somewhere in your code that is 'hiding' the UDF from the script.

maciep
(Korg Regular)
2004-01-28 09:22 PM
Re: Argh!!!! WMIQuery() not working

How exactly do you call the WMIQuery UDF? Have you tried just copying the function into your script?

cwhitmore
(Starting to like KiXtart)
2004-01-28 09:45 PM
Re: Argh!!!! WMIQuery() not working

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'



maciep
(Korg Regular)
2004-01-28 10:04 PM
Re: Argh!!!! WMIQuery() not working

What's with the '@' symbol? Are you using other udf libraries in this script that are in the same location as wmiquery? Make sure the path to your UDF is correct.

cwhitmore
(Starting to like KiXtart)
2004-01-28 10:17 PM
Re: Argh!!!! WMIQuery() not working

'@' symbol allows me to point to a directory below the \NETLOGON directory which works fine for the three other UDF's in the script.

maciep
(Korg Regular)
2004-01-28 10:28 PM
Re: Argh!!!! WMIQuery() not working

Do you call all of your UDFs at once (like at the beginning of your script)? Or do you call them when you use them? What's your current directory when you call wmiquery.udf?

For some reason it is not finding that udf. Have you tried calling @lserver\netlogon\functions\wmiquery.udf. Is your udf replicated to all of your servers.