Jump to content
Sign in to follow this  
strah

winmgmts options from vbs to au3

Recommended Posts

strah

Hi!

(they suggested me to post it in this forum)

Could anyone help me out with converting simple vbs script to au3 script.

Here is the vbs script content:

------------------------------------------------------

Const ALL_USERS = True

Set objService = GetObject("winmgmts:")

Set objSoftware = objService.Get("Win32_Product")

errReturn = objSoftware.Install("C:\SomeApplication.msi", , ALL_USERS)

MsgBox "Done"

--------------------------------------------------------

Here is my attempt to convert it to AutoIt:

--------------------------------------------------------

Const $ALL_USERS = 1

$objService = ObjGet("winmgmts:")

$objSoftware = $objService.Get("Win32_Product")

$errReturn = $objSoftware.Install("C:\SomeApplication.msi", , $ALL_USERS)

MsgBox(0,"","Done")

--------------------------------------------------------

This au3 script gives me an error.

I also used VBS2AutoIt_Converter to try to find my error, but VBS2AutoIt_Converter does pretty much what I did, so I could not detect the error.

If, however, I replace

$errReturn = $objSoftware.Install("C:\SomeApplication.msi", , $ALL_USERS)

with

$errReturn = $objSoftware.Install("C:\SomeApplication.msi")

it does work, but I would like to be able to keep ALL_USERS option. Anyone could help me find out what is wrong in line and how to correct it?

$errReturn = $objSoftware.Install("C:\SomeApplication.msi", , $ALL_USERS)

Thanks in advance,

Strah

Share this post


Link to post
Share on other sites
MHz

(they suggested me to post it in this forum)

Your not using AutoItX so someone suggested wrong. Please use your post in the other forum. :shocked:

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.