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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

multiple commands

Status
Not open for further replies.

deltsigjoe

IS-IT--Management
Apr 12, 2011
16
US
Hello All,
I am working with a VBScript that has the following code:

******************************************
SOME CODE....

SetCacheSize("C:")

cmd = "MSIEXEC /i " & Chr(34) & "\\utep.edu\installs\App-V\setup.msi" & Chr(34) & " INSTALLDIR=" & Chr(34) & "C:\Program Files\Softricity\SoftGrid for Windows Desktops" & Chr(34) & " SWICACHESIZE=" & Chr(34) & "8192" & Chr(34) & " SWIDCSDISPLAY=" & Chr(34) & "UTEP-AppV" & Chr(34) & " SWIPUBSVRHOST=" & Chr(34) & "appvpro.utep.edu" & Chr(34) & " SWIPUBSVRREFRESH=" & Chr(34) & "on" & Chr(34) & " SWIPUBSVRPATH=" & Chr(34) & "/" & Chr(34) & " SWIPUBSVRTYPE=" & Chr(34) & "RTSP" & Chr(34) & " SWIFSDRIVE=" & Chr(34) & "Q" & Chr(34) & " SWIPUBSVRPORT=" & Chr(34) & "554" & Chr(34) & " SWISKIPDATASETTINGS=" & Chr(34) & "True" & Chr(34) & " /passive /forcerestart /l*v c:\appv.log"

SET objSh = WScript.CreateObject("WScript.Shell")
objSh.Run cmd,1,true

MORE CODE...
**********************************************

is there a way to add multiple lines like the following:
cmd = "MSIEXEC /i " & Chr(34) & "\\utep.edu\installs\App-V\setup.msi"
 
I don't understand your question. The cmd string looks good to go, though.

-Geates

 
The cmd part works, but I need to create another command entry. Do I create another vbscript or can I add to the existing code to include a new command line?
 
The extra part of the code I want to add is the following:

msiexec /i offvirt.msi PIDKEYS=xxxx-xxxx-xxxxx-xxxx-xxxxx USEROPERATIONS=1


I am not sure if I need to create another VBScript or if I can just add this porttion either before or after the existing code.
 
can I do something like the following:

******************************************
SOME CODE....

SetCacheSize("C:")

cmd = "MSIEXEC /i " & Chr(34) & "\\utep.edu\installs\App-V\setup.msi" & Chr(34) & " INSTALLDIR=" & Chr(34) & "C:\Program Files\Softricity\SoftGrid for Windows Desktops" & Chr(34) & " SWICACHESIZE=" & Chr(34) & "8192" & Chr(34) & " SWIDCSDISPLAY=" & Chr(34) & "UTEP-AppV" & Chr(34) & " SWIPUBSVRHOST=" & Chr(34) & "appvpro.utep.edu" & Chr(34) & " SWIPUBSVRREFRESH=" & Chr(34) & "on" & Chr(34) & " SWIPUBSVRPATH=" & Chr(34) & "/" & Chr(34) & " SWIPUBSVRTYPE=" & Chr(34) & "RTSP" & Chr(34) & " SWIFSDRIVE=" & Chr(34) & "Q" & Chr(34) & " SWIPUBSVRPORT=" & Chr(34) & "554" & Chr(34) & " SWISKIPDATASETTINGS=" & Chr(34) & "True" & Chr(34) & " /passive /forcerestart /l*v c:\appv.log"

****ADDED CODE***
cmd = "MSIEXEC /i offvirt.msi PIDKEYS=xxxx-xxxx-xxxxx-xxxx-xxxxx USEROPERATIONS=1"


SET objSh = WScript.CreateObject("WScript.Shell")
objSh.Run cmd,1,true

MORE CODE...
**********************************************
 
try something along the lines of
Code:
' SOME CODE....

SetCacheSize("C:")

SET objSh = WScript.CreateObject("WScript.Shell")

cmd = "MSIEXEC /i " & Chr(34) & "\\utep.edu\installs..." [COLOR=green]' original truncated[/color]
objSh.Run cmd,1,true [COLOR=green]' run original command[/color]

cmd = "MSIEXEC  /i offvirt.msi PIDKEYS=xxxx-xxxx-xxxxx-xxxx-xxxxx USEROPERATIONS=1"
objSh.Run cmd,1,true [COLOR=green]' run new command[/color] 

' MORE CODE...
 
I will test first thing in the morning. Thank you so much.
 
I run the following code and get an error message:
Invalid command line argument. Consult the windows installer SDK for detailed command line help"

here is the code

' some code

SetCacheSize("C:")
SET objSh = WScript.CreateObject("WScript.Shell")

cmd = "MSIEXEC /i " & Chr(34) & "\\utep.edu\installs\App-V\setup.msi" & Chr(34) & " INSTALLDIR=" & Chr(34) & "C:\Program Files\Softricity\SoftGrid for Windows Desktops" & Chr(34) & " SWICACHESIZE=" & Chr(34) & "8192" & Chr(34) & " SWIDCSDISPLAY=" & Chr(34) & "UTEP-AppV" & Chr(34) & " SWIPUBSVRHOST=" & Chr(34) & "appvpro.utep.edu" & Chr(34) & " SWIPUBSVRREFRESH=" & Chr(34) & "on" & Chr(34) & " SWIPUBSVRPATH=" & Chr(34) & "/" & Chr(34) & " SWIPUBSVRTYPE=" & Chr(34) & "RTSP" & Chr(34) & " SWIFSDRIVE=" & Chr(34) & "Q" & Chr(34) & " SWIPUBSVRPORT=" & Chr(34) & "554" & Chr(34) & " SWISKIPDATASETTINGS=" & Chr(34) & "True" & Chr(34) & " /passive /forcerestart /l*v c:\appv.log"
objSh.Run cmd,1,true

cmd = "MSIEXEC /i " & Chr(34) & "\\utep.edu\installs\App-V\OfficePack\offvirt.msi" & Chr(34) & " PIDKEYS=" & Chr(34) & "XXXX-XXXXX-XXXXX-XXXXX-XXXXX" & Chr(34) & " USEROPERATIONS=" & Chr(34) & "1"
objSh.Run cmd,1,true ' run new command

'more code
 
You are missing one quote at the end.

cmd = "MSIEXEC /i " & Chr(34) & "\\utep.edu\installs\App-V\OfficePack\offvirt.msi" & Chr(34) & " PIDKEYS=" & Chr(34) & "XXXX-XXXXX-XXXXX-XXXXX-XXXXX" & Chr(34) & " USEROPERATIONS=" & Chr(34) & "1" [red]& Chr(34)[/red]

-Geates

"I hope I can feel and see the change - stop the bleed inside a feel again. Cut the chain of lies you've been feeding my veins; I've got nothing to say to you!"
-Infected Mushroom
 
I just ran it and only the first cmd executes... not the second
 
I went ahead and reversed them (bottom on top and top on the bottom), but still only the first ran and not the second :(
 
better yet why dont you put the msiexec calls in a batch file then run that batch file instead?
 
I am deploying this through group policy. would a batch file be better??
 
You have the 'wait on return' option set to true, does the command complete normally without errors?
 
See if objSh says there is an error on the second command.
Code:
boolError = objSh.Run cmd, 1, true
if (boolError) then
   'There is an error
end if

If so, try running the second command manually at the cmd prompt so you can see any error msiexec may have returned.

-Geates

"I hope I can feel and see the change - stop the bleed inside a feel again. Cut the chain of lies you've been feeding my veins; I've got nothing to say to you!"
-Infected Mushroom
 
I will try, but if I run each command manually at the cmd prompt, they work just fine.
the problem is when I run them combined
 
1. Eliminate all the arguments in the second command. Add them back one by one, executing the command after each addition.

2. msiexec shouldn't have a problem running multiple instances but it's possible that the msiexec from the previous command is still active. At least in my environment, msiexec would hang from time to time when deploying a package; subsequent msiexec executions would fail.

monitor how much time passes after the first command "finishes". If it seems as though msiexec is hanging, kill it and launch the second command.

Code:
dtmStart = now
  cmd = "MSIEXEC /i ..."
  objSh.Run cmd, 1, true
dtmEnd = now

boolKill = true
set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
do until (datediff("s", dtmStart, dtmEnd) > 30) '30 seconds
    set colProcesses = objWMIService.ExecQuery("Select * from Win32_Process Where Name='msiexec.exe'")
    if (colProcesses.count = 0) then
       boolKill = false
       exit do
    end if
loop

if (boolKill) then
    set colProcesses = objWMIService.ExecQuery("Select * from Win32_Process Where Name='msiexec.exe'")
    for each objProcess in colProcesses
        objProcess.Terminate()
    next
end if

cmd = "MSIEXEC /i ..."
objSh.Run cmd, 1, true

3. Also, try running the commands as sub process of CMD by invoking CMD first. I would be both very surprised and not at all if this worked.

Code:
cmd = "MSIEXEC /i ..."
objSh.Run [red]"%COMSPEC% /c [/red]" & cmd, 1, true

-Geates

"I hope I can feel and see the change - stop the bleed inside a feel again. Cut the chain of lies you've been feeding my veins; I've got nothing to say to you!"
-Infected Mushroom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top