/build/static/layout/Breadcrumb_cap_w.png

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

0 Comments   [ + ] Show comments

Answers (2)

Posted by: BarryB 18 years ago
Orange Belt
1
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
Posted by: BarryB 18 years ago
Orange Belt
0
OK narrowed it down to be the
intDP = "C:\Windows\system32\dosprint"&chr(32)&"install"

for whatever reason it will not run the command "dosprint.exe install" yet when this is done manually then the job run though sms the net start works A OK.. why is it not running the install?
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ