VBscipt not working via SMS
I have a simple script that would copy the files from the server to the client local temp folder and iniciate the installation from the temp folder. My code goes like this
Set FSO = CreateObject("Scripting.FileSystemObject")
FSO.CopyFile "software.msi", "c:\windows\temp\" ,True
FSO.CopyFile "softwareSecurity.EXE", "c:\windows\temp\" ,True
Set WshShell = WScript.CreateObject("WScript.Shell")
Dim msi
Set msi = CreateObject("WindowsInstaller.Installer")
msi.UILevel=2
msi.InstallProduct "c:\windows\temp\software.msi", ""
WshShell.Run "C:\windows\Temp\softwareSecurity.exe /qn", 1, True
Set WshShell= Nothing
Code works in a local machine including the install. Tried SMS too. It copies the .msi and the security.exe to the temp folder, but just doesn't run the two executable commands. I checked on some post here and google, it talked about rights issue, my machine has prevliged rights. At this point all I care about is copying the msi to the local temp folder and execute the msi from there. SMS can handle the security.exe part.
Can anyone tell me what I am doing wrong!
Thanks in advance
FSO.CopyFile "software.msi", "c:\windows\temp\" ,True
FSO.CopyFile "softwareSecurity.EXE", "c:\windows\temp\" ,True
Set WshShell = WScript.CreateObject("WScript.Shell")
Dim msi
Set msi = CreateObject("WindowsInstaller.Installer")
msi.UILevel=2
msi.InstallProduct "c:\windows\temp\software.msi", ""
WshShell.Run "C:\windows\Temp\softwareSecurity.exe /qn", 1, True
Set WshShell= Nothing
0 Comments
[ + ] Show comments
Answers (1)
Please log in to answer
Posted by:
anonymous_9363
15 years ago
The script is...basic, to say the least, as there is zero error-trapping for non-creation of objects, no check whether or not the files made it to the target and so on. Anyway...
To keep it simple (you're missing some stuff that needs to be done with the Installer object) and consistent, I'd change these lines:
To keep it simple (you're missing some stuff that needs to be done with the Installer object) and consistent, I'd change these lines:
Dim msi
Set msi = CreateObject("WindowsInstaller.Installer")
msi.UILevel=2
msi.InstallProduct "c:\windows\temp\software.msi", ""
to:WshShell.Run "msiexec /i c:\windows\temp\software.msi /qn", 1, True
Oh and I'd get out of the habit of using the 'WScript.' directive in front of calls to the 'CreateObject' method. If you use VBS in Custom Actions, this will trip you up.
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.