Page 1 of 1 1
Topic Options
#181087 - 2007-10-03 06:20 PM WMI Win32_Product class issues
werealldevo Offline
Fresh Scripter

Registered: 2007-10-03
Posts: 11

$objWMIService = GetObject("winmgmts:\\"+ $workstation + "\root\cimv2").Get("Win32_Product")

$errReturn = $objWMIService.Install("c:\blahblah\testapp.msi", , ALL_USERS)

Produces this error :
Win32_Product
ERROR : expected ')'!
Script: C:\Temp\scripts\testinst.kix
Line : 5

Line5 -- > $errReturn = $objWMIService.Install("c:\blahblah\testapp.msi", , ALL_USERS)

Any ideas?

Top
#181089 - 2007-10-03 07:58 PM Re: WMI Win32_Product class issues [Re: werealldevo]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
Did not test this, but just some searching on the Internet
http://www.microsoft.com/technet/scriptcenter/guide/sas_cpm_nila.mspx?mfr=true
Maybe
 Code:
$errReturn = $objWMIService.Install("c:\blahblah\testapp.msi", , True)

Top
#181090 - 2007-10-03 08:06 PM Re: WMI Win32_Product class issues [Re: Witto]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Witto,

I guess you mean the page just below the one you linked to. The link shows stuff for installing an app local.

Here is the link for remote installation.
http://www.microsoft.com/technet/scriptcenter/guide/sas_cpm_gnbr.mspx?mfr=true
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#181099 - 2007-10-03 10:07 PM Re: WMI Win32_Product class issues [Re: Mart]
werealldevo Offline
Fresh Scripter

Registered: 2007-10-03
Posts: 11
Hey Guys,

Thanks for the replies.

Regardless of the locale (remote or local) the error I am receiving seems syntactical, e.g., this code does not convert to kixtart:

Const ALL_USERS = True
Set objService = GetObject("winmgmts:")
Set objSoftware = objService.Get("Win32_Product")
errReturn = objSoftware.Install("c:\scripts\database.msi", , ALL_USERS)

should translate to:

$objWMIService = GetObject("winmgmts:\root\cimv2").Get("Win32_Product")
$errReturn = $objWMIService.Install("c:\blahblah\testapp.msi", , ALL_USERS)

When you run the above code, you get this error:

Win32_Product
ERROR : expected ')'!
Script: C:\Temp\scripts\testinst.kix
Line : 5

Line5 -- > $errReturn = $objWMIService.Install("c:\blahblah\testapp.msi", , ALL_USERS)

Any ideas?

Top
#181101 - 2007-10-03 10:22 PM Re: WMI Win32_Product class issues [Re: werealldevo]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
Not sure what's before these two lines, but I've pulled more than one hair out with this kind of error, only to find a missing or mismatched quote on one of the prior lines.

You might want to grab the Sanity UDF and run your file through it if you can't find it by eye.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#181108 - 2007-10-03 11:12 PM Re: WMI Win32_Product class issues [Re: Glenn Barnas]
werealldevo Offline
Fresh Scripter

Registered: 2007-10-03
Posts: 11
Hi Glenn,

Awesome UDF, btw. No errors found however. Am I calling this WMI incorrectly?

Thanks!

Top
#181110 - 2007-10-03 11:39 PM Re: WMI Win32_Product class issues [Re: Mart]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
Mart,
Maybe you are right, but the essential was the ALL_USERS being a constant. So I thought that has to be True or -1 or any other numeric value <>0.

Top
#181112 - 2007-10-04 12:25 AM Re: WMI Win32_Product class issues [Re: Witto]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
ALL_USERS isn't a constant in Kix, tho. Try calling it with a numeric val, like -1

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#181113 - 2007-10-04 12:30 AM Re: WMI Win32_Product class issues [Re: Glenn Barnas]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
That is what I tried to explain. Thanks ;\)
Top
Page 1 of 1 1


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

Who's Online
1 registered (Allen) and 1198 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.083 seconds in which 0.046 seconds were spent on a total of 13 queries. Zlib compression enabled.

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