Page 1 of 1 1
Topic Options
#144447 - 2005-07-28 04:40 PM searching for a missing )
Co Offline
MM club member
***

Registered: 2000-11-20
Posts: 1342
Loc: NL
Got a weird problem. I 've got the following error message:

Quote:


>>> KiXtart 2001 <<<

ERROR: expected ')'!
Script: c:\scripts\test\CMDB.kix
Line: 19





I can't find the )


Never had this problem before with WMI.
Ooh and I use kix 4.50 since a few days. BTW.
Isn't it kix 2010 instead of kix 2001??

Have tested it with 4.23 also but still the same problem:

Code:
  
Break On

$strComputer = @wksta

$srv="\\server\log"+$strComputer+".txt"
$objWMIService = GetObject("winmgmts:\\" + $strComputer + "\root\cimv2")

Open(1,$srv,5)

; Gebruiker
$objWMIService = GetObject("winmgmts:" + "{impersonationLevel=impersonate}!\\" + $strComputer & "\root\cimv2")
$colItems = $objWMIService.ExecQuery ("Select * from Win32_ComputerSystem",,48)
For Each $objItem In $colItems
$logdata=$objItem.UserName+Chr(9)
$nul=WriteLine(1,$logdata)
Next

; hostname
$colItems = $objWMIService.ExecQuery("Select * from Win32_OperatingSystem",,48)
For Each $objItem In $colItems
$logdata=$objItem.CSName+Chr(9)+$objItem.SerialNumber+Chr(9)
$nul=WriteLine(1,$logdata)
Next

;ComputerSystemProduct
$colItems = $objWMIService.ExecQuery("Select * from Win32_ComputerSystemProduct",,48)
For Each $objItem In $colItems
$logdata=$objItem.vendor+Chr(9)+$objItem.name+Chr(9)+$objItem.IdentifyingNumber+Chr(9)
$nul=WriteLine(1,$logdata)
Next

;Processor
$colItems = $objWMIService.ExecQuery("Select * from Win32_Processor",,48)
For Each $objItem In $colItems
$logdata=$objItem.Name+Chr(9)+$objItem.MaxClockSpeed+Chr(9)
$nul=WriteLine(1,$logdata)
Next

;LogicalMemoryConfiguration
$colItems = $objWMIService.ExecQuery("Select * from Win32_LogicalMemoryConfiguration",,48)
$nul=WriteLine(1,$menu)
For Each $objItem In $colItems
$logdata=$objItem.TotalPhysicalMemory+Chr(9)
$nul=WriteLine(1,$logdata)
Next

close(1)


_________________________
Co


Top
#144448 - 2005-07-28 04:51 PM Re: searching for a missing )
maciep Offline
Korg Regular
*****

Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
A second pair of eyes is always nice...replace the '&' with a '+'

$objWMIService = GetObject("winmgmts:" + "{impersonationLevel=impersonate}!\\" + $strComputer &"\root\cimv2")

Top
#144449 - 2005-07-28 05:00 PM Re: searching for a missing )
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Is there a missing hack '\' in the following line?
$srv="\\server\log"+$strComputer+".txt"

Seems to me, there needs to be a share name in the path. Is 'log' the share?

You are optimistic that Open() works and you don't handle the return code.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#144450 - 2005-07-28 11:04 PM Re: searching for a missing )
Co Offline
MM club member
***

Registered: 2000-11-20
Posts: 1342
Loc: NL
Maciep,

Thanks for you pair of eyes . I was staring at it for a while but I couldn't find it... tommorrow morning I'll let you know if it solves the problem.

Les,

You have seen it right but it is a typo which doesn't cause the problem. I've changed the share before I posted the script...


Edited by Co (2005-07-28 11:06 PM)
_________________________
Co


Top
#144451 - 2005-07-29 07:52 AM Re: searching for a missing )
Co Offline
MM club member
***

Registered: 2000-11-20
Posts: 1342
Loc: NL
Maciep,

That did it, Thanks again!!

Think I have to put on my glasses again, I have the eyes of a mole .
_________________________
Co


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
0 registered and 2220 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.066 seconds in which 0.037 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