SMS > VB Script > Install DOS service
Hi ppl,
SMS distributes the application (Dosprint) by running a VBScript which installs the MSI then attempts to do the following>
intDP = "C:\Windows\system32\dosprint"&chr(32)&"install"
excDP = "C:\Windows\system32\net"&chr(32)&"start"&chr(32)&"dosprint"
WshShell.run intDP,0,wait
WshShell.run excDP,0,wait
This runs OK as me, but when sent via sms it does not install then start the service. I have put messgae boxes in the script and they popup OK so it is running OK but it is not installing then starting the service.
Any ideas?
Barry
SMS distributes the application (Dosprint) by running a VBScript which installs the MSI then attempts to do the following>
intDP = "C:\Windows\system32\dosprint"&chr(32)&"install"
excDP = "C:\Windows\system32\net"&chr(32)&"start"&chr(32)&"dosprint"
WshShell.run intDP,0,wait
WshShell.run excDP,0,wait
This runs OK as me, but when sent via sms it does not install then start the service. I have put messgae boxes in the script and they popup OK so it is running OK but it is not installing then starting the service.
Any ideas?
Barry
0 Comments
[ + ] Show comments
Answers (2)
Please log in to answer
Posted by:
BarryB
18 years ago
Solved thanks to a couple of pointers from chaps on Google Groups :) Here is my solution:
Created a separate install in the DOS print package that only runs when
the users are logged in, it invokes a vb script that uses "run as" and
an AD account to install and start the service, as Mike pointed out it
appears to need to use Domain credentials. The new install is set with
a dependency on DOS print which is a separate package and installs the
EXE and directory structure required via an MSI.
Thanks again for all your help,
---------------------------------------------------------------------------ÂÂ-------
On Error Resume Next
Suppresses Errors
Dim Shell, WshShell,FSO
set WshShell = CreateObject("WScript.Shell")
Wscript.Sleep 2000 'Sleeps to ensure MSI has completed
sUser="YOUR_AD\Service_Account"
sPass="Your_Password"&VbCrLf
sCmd="C:\Windows\System32\DOSPrint.exe install" 'Cmd line that installs DOS Print Service
tCmd="C:\Windows\System32\net start DOSPrint" 'Cmd line that starts service
set WshShell = CreateObject("WScript.Shell")
set WshEnv = WshShell.Environment("Process")
WinPath = WshEnv("SystemRoot")&"\System32\runas.exe"
set FSO = CreateObject("Scripting.FileSystemObject")
rc=WshShell.Run("runas /user:" & sUser & " " & CHR(34) & sCmd & CHR(34), 2, FALSE)
Wscript.Sleep 50 'need to give time for window to open.
WshShell.AppActivate(WinPath) 'make sure we grab the right window to
send password to
WshShell.SendKeys sPass 'send the password to the waiting window.
Wscript.Sleep 4000 'Gives service time to install properly
rc=WshShell.Run("runas /user:" & sUser & " " & CHR(34) & tCmd & CHR(34), 2, FALSE)
Wscript.Sleep 50 'need to give time for window to open.
WshShell.AppActivate(WinPath) 'make sure we grab the right window to send password to
WshShell.SendKeys sPass 'send the password to the waiting window.
Set WshShell=Nothing
set WshEnv=Nothing
set FSO=Nothing
wscript.quit
Created a separate install in the DOS print package that only runs when
the users are logged in, it invokes a vb script that uses "run as" and
an AD account to install and start the service, as Mike pointed out it
appears to need to use Domain credentials. The new install is set with
a dependency on DOS print which is a separate package and installs the
EXE and directory structure required via an MSI.
Thanks again for all your help,
---------------------------------------------------------------------------ÂÂ-------
On Error Resume Next
Suppresses Errors
Dim Shell, WshShell,FSO
set WshShell = CreateObject("WScript.Shell")
Wscript.Sleep 2000 'Sleeps to ensure MSI has completed
sUser="YOUR_AD\Service_Account"
sPass="Your_Password"&VbCrLf
sCmd="C:\Windows\System32\DOSPrint.exe install" 'Cmd line that installs DOS Print Service
tCmd="C:\Windows\System32\net start DOSPrint" 'Cmd line that starts service
set WshShell = CreateObject("WScript.Shell")
set WshEnv = WshShell.Environment("Process")
WinPath = WshEnv("SystemRoot")&"\System32\runas.exe"
set FSO = CreateObject("Scripting.FileSystemObject")
rc=WshShell.Run("runas /user:" & sUser & " " & CHR(34) & sCmd & CHR(34), 2, FALSE)
Wscript.Sleep 50 'need to give time for window to open.
WshShell.AppActivate(WinPath) 'make sure we grab the right window to
send password to
WshShell.SendKeys sPass 'send the password to the waiting window.
Wscript.Sleep 4000 'Gives service time to install properly
rc=WshShell.Run("runas /user:" & sUser & " " & CHR(34) & tCmd & CHR(34), 2, FALSE)
Wscript.Sleep 50 'need to give time for window to open.
WshShell.AppActivate(WinPath) 'make sure we grab the right window to send password to
WshShell.SendKeys sPass 'send the password to the waiting window.
Set WshShell=Nothing
set WshEnv=Nothing
set FSO=Nothing
wscript.quit
Posted by:
BarryB
18 years ago
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.