How to run an MSI install as admin with VBscript

Anything VBScript-related, including Windows Script Host, WMI, ADSI, and more.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Locked
User avatar
galbanis
Posts: 2
Joined: Mon Jan 30, 2012 5:24 am

How to run an MSI install as admin with VBscript

Post by galbanis » Mon Jan 30, 2012 5:26 am

Hello...just wondering if anyone can assist with the following: set WshShell = CreateObject("WScript.Shell") WshShell.Run "runas /user:administrator ""msoidcli.msi""" WScript.Sleep 300 WshShell.Sendkeys "xxxxxx~" Now the problem I'm having is sticking the "msiexec /i" command in there. If I do this: WshShell.Run"runas /user:administrator ""msiexec /i msoidcli.msi""" It does not see the /i switch and the installer package. I also tried a set command and doing a runas on a variable but I get the same results....

User avatar
galbanis
Posts: 2
Joined: Mon Jan 30, 2012 5:24 am

How to run an MSI install as admin with VBscript

Post by galbanis » Mon Jan 30, 2012 5:26 am

Hello...just wondering if anyone can assist with the following: set WshShell = CreateObject("WScript.Shell") WshShell.Run "runas /user:administrator ""msoidcli.msi""" WScript.Sleep 300 WshShell.Sendkeys "xxxxxx~" Now the problem I'm having is sticking the "msiexec /i" command in there. If I do this: WshShell.Run"runas /user:administrator ""msiexec /i msoidcli.msi""" It does not see the /i switch and the installer package. I also tried a set command and doing a runas on a variable but I get the same results....

User avatar
jvierra
Posts: 13289
Joined: Tue May 22, 2007 9:57 am
Contact:

How to run an MSI install as admin with VBscript

Post by jvierra » Mon Jan 30, 2012 6:38 am

In this situation SendKeys will not work.

You would be better off running the MSI directly.
WshShell.Run"runas /user:administrator msoidcli.msi"
MSI files are automated and the runas should find the MSIEXEC program automatically.

You cannot use RunAs to elevate a command. You will still get a UAC prompt.

MSI files are easier to install via Group Policy.


User avatar
jvierra
Posts: 13289
Joined: Tue May 22, 2007 9:57 am
Contact:

How to run an MSI install as admin with VBscript

Post by jvierra » Mon Jan 30, 2012 10:04 am

Warniung - pasword crackers can decryupt passwords stored using the basic encryption scheme of WIndows.


What you are rdoing is one thing web malware look for. It is so easy to do that it is a joke.

I have a disk that can decrypt a password encrypted with the basic password encryption in a users account in a second.

Consider using a remote install. WMI can do this admistratively even in a workgroup.


Locked