Page 1 of 1 1
Topic Options
#112686 - 2004-01-28 06:56 PM Argh!!!! WMIQuery() not working
cwhitmore Offline
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 Offline
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?
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#112688 - 2004-01-28 08:15 PM Re: Argh!!!! WMIQuery() not working
cwhitmore Offline
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 Offline
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?

_________________________
How to ask questions the smart way <-----------> Before you ask

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

Registered: 2001-05-23
Posts: 102
Loc: Austin, Texas, USA
Yes I am.
Top
#112691 - 2004-01-28 08:25 PM Re: Argh!!!! WMIQuery() not working
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
it would be cool if you would provide us the info what is line 33.
_________________________
!

download KiXnet

Top
#112692 - 2004-01-28 08:26 PM Re: Argh!!!! WMIQuery() not working
Radimus Moderator Offline
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

_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#112693 - 2004-01-28 08:37 PM Re: Argh!!!! WMIQuery() not working
cwhitmore Offline
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 Offline
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.
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#112695 - 2004-01-28 09:22 PM Re: Argh!!!! WMIQuery() not working
maciep Offline
Korg Regular
*****

Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
How exactly do you call the WMIQuery UDF? Have you tried just copying the function into your script?
_________________________
Eric

Top
#112696 - 2004-01-28 09:45 PM Re: Argh!!!! WMIQuery() not working
cwhitmore Offline
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
#112697 - 2004-01-28 10:04 PM Re: Argh!!!! WMIQuery() not working
maciep Offline
Korg Regular
*****

Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
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.
_________________________
Eric

Top
#112698 - 2004-01-28 10:17 PM Re: Argh!!!! WMIQuery() not working
cwhitmore Offline
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
#112699 - 2004-01-28 10:28 PM Re: Argh!!!! WMIQuery() not working
maciep Offline
Korg Regular
*****

Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
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.
_________________________
Eric

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 382 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.066 seconds in which 0.024 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org