Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Troubles running MSI with PsExec within a vbscript

Status
Not open for further replies.

pork1977

Technical User
Feb 15, 2006
20
0
0
GB
Hi,

Wondered if somebody could kindly fix this up for me?

All I'm tryinng to do is push out a MSI using the PsExec tool remotley to other servers on the network.
I currently have it working as I need to in a batch file but need to convert this to a vbscript and my knowledge with vbscript isn't that great. It's a fairly long command line and this is just an example of one with all the parameters. When I try running the below though, all I seem to get is errors such as 'Expected end of statement' and Code 800A0401. I'm guessing it has something to do with the format of the string with quotes being in wrong places, not too sure.

Set wshshell = CreateObject("WScript.Shell")
Set runInstall = wshshell.Run"C:\psexec.exe \\BASSOL-PKGL-04 -u "username" -p "password" /accepteula /h /e msiexec /i "\\servername\share\myMSI.msi" AUTHENTICATION="NT" MASTER_SQL_INSTANCE="bassol-sqll-01\dev" PORT_CASMT="65001" MESSAGING_SERVER="localhost" MASTER_MAIN_DATABASE="qa2_2_17_Main" MYUSERNAME="svc" MYPASSWORD="Password1" /quiet",0,True

Thank you,
Paul
 
Not to worry, managed to do what I wanted to in the end with a little bit more research.
Ended up like this: (put up incase anyone was interested, and for my own reference! although this is a cut down version of what I ended up)

strPSExec = "C:\psexec.exe"
strMSI = "C:\MyMSI.msi"
strAdminUser = "test"
strPassword = "Password1"
strComputer = "BASSOL-PKGL-04"

Set objShell = CreateObject("Wscript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")

strCommand = strPSExec & " -accepteula -e -h -u " & chr(34) & strAdminUser & chr(34) & " -p " & chr(34) & strPassword & chr(34) & " \\" & strComputer & " msiexec /i " & chr(34) & strMSI1 & chr(34) & " AUTHENTICATION=" & chr(34) & "NT" & chr(34) & " MASTER_SQL_INSTANCE=" & chr(34) & "bassol-sqll-01\dev" & chr(34) & " PORT_CASMT=" & chr(34) & "65001" & chr(34) & " MESSAGING_SERVER=" & chr(34) & "localhost" & chr(34) & " MASTER_MAIN_DATABASE=" & chr(34) & "qa2_2_17_Main" & chr(34) & " MYUSERNAME=" & chr(34) & "domain\username" & chr(34) & " MYPASSWORD=" & chr(34) & "Password1" & chr(34) & " /quiet"

intReturn = objShell.Run(strCommand, 0, True)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top