This might seem like a dump question, but my complete ignorance with VbScript is giving me no chance to try to work it out. In short, a system administrator friend of mine, asked me to write him a script that should allow him to enter a remote machine name, a domain credentials, and an MSI package that will be installed on the specified remote machine.
I know this is silly, I mean, come on! No one can just log in to SO and ask for a cake, people should ask about how to get the cake cooked. I know, but please forgive my absolute laziness and help!
Asked
Active
Viewed 6,844 times
2
-
Should this go to ServerFault? – Ahmed Jun 15 '09 at 09:10
4 Answers
3
This will open simple input boxes to get the required information. *NOTE: Input is only checked to make sure it is not blank, entering invalid data will cause the script to fail.
strUser = ""
strPassword = ""
strMSI = ""
strComputer = ""
'Get user name, cannot be blank
Do While strUser = ""
strUser = InputBox("Enter user name", "User Name")
Loop
'Get password, cannot be blank
Do While strPassword = ""
strPassword = InputBox("Enter password", "Password")
Loop
'Get msi package path, cannot be blank
Do While strMSI = ""
strMSI = InputBox("Enter the path to the msi package", "MSI package")
Loop
'Get destination computer, cannot be blank
Do While strComputer = ""
strComputer = InputBox("Enter the destination computer name", "Computer")
Loop
Const wbemImpersonationLevelDelegate = 4
Set objWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set objConnection = objwbemLocator.ConnectServer _
(strComputer, "root\cimv2", strUser, strPassword)
objConnection.Security_.ImpersonationLevel = wbemImpersonationLevelDelegate
Set objSoftware = objConnection.Get("Win32_Product")
errReturn = objSoftware.Install(strMSI,,True)
** This script is untested.

Tester101
- 8,042
- 13
- 55
- 78
2
Can you use psexec?
Or, it seems you can use the Install method of the WMI Win32_Product class. See technet for more info. There's some more info in this serverwatch article too

Dan F
- 11,958
- 3
- 48
- 72
2
TechNet has a sample script: Install Software on a Remote Computer.

Helen
- 87,344
- 17
- 243
- 314
-
Actually the required script should prompt the user for the domain credentials, the MSI package path, and destination computer. The one you posted doesn't! – Ahmed Jun 15 '09 at 09:14
-
-
0
Write some VbScript around the commands outlined here: "Remote Unattended MSI Installation with PsExec" - http://www.geekytidbits.com/unattended-msi-installation-psexec/

Brady Holt
- 2,844
- 1
- 28
- 34