SMS 2003 & Launching Apps from batch files
Hi,
My problem relates specifically to trying to install the SQL Server 2000 Client Tools in silent (unattend) mode.
Here's what I've done:
1. Following the MS documentation I've created the .iss file for inclusion with the installation
2. I've created a batch file which launches the unattend setup using the following command:
start /wait "[UNC path]\setupsql.exe" k=SMS -s -m -SMS -f1 "[UNC path]\sqlcli.iss"
3. I've created a software package on SMS and which runs this batch file then advertised it to the client. (Configured to run when user is logged in)
Result:
SMS logs that the package is received and begins installing however proceeds no further. I get no success or failure result.
If I manually run the batch file from the client, the install works fine.
I've experimented by creating a simple batch file which calls notepad.exe and I get the same result. So I'm assuming there's an error in the way I'm launching apps within a batch file distributed with SMS.
Help would be appreciated.
Thanks,
Dan.
My problem relates specifically to trying to install the SQL Server 2000 Client Tools in silent (unattend) mode.
Here's what I've done:
1. Following the MS documentation I've created the .iss file for inclusion with the installation
2. I've created a batch file which launches the unattend setup using the following command:
start /wait "[UNC path]\setupsql.exe" k=SMS -s -m -SMS -f1 "[UNC path]\sqlcli.iss"
3. I've created a software package on SMS and which runs this batch file then advertised it to the client. (Configured to run when user is logged in)
Result:
SMS logs that the package is received and begins installing however proceeds no further. I get no success or failure result.
If I manually run the batch file from the client, the install works fine.
I've experimented by creating a simple batch file which calls notepad.exe and I get the same result. So I'm assuming there's an error in the way I'm launching apps within a batch file distributed with SMS.
Help would be appreciated.
Thanks,
Dan.
0 Comments
[ + ] Show comments
Answers (5)
Please log in to answer
Posted by:
usachrisk
20 years ago
I use SMS 2.0 and had the same issue the first time I tried to launch using a batch file. The solution for me at the time was to grab a freeware tool that compiled the batch file into a COM file and I think I remember that working fine. Since then, I've done most anything that I would have done in at Batch file in the SMS Installer and compiled it into an EXE. It's probably something simple, but I worked for a few days wondering why my app didn't launch on the remote computer.
Posted by:
lewishan
20 years ago
Hmmm. Using Wise Script I've compiled an .exe with the same run command, however I get the same result, although this time SMS reports the advertisment as being successful, however the SQL setup doesn't start. I've confirmed this by removing the -s (install silent switch). When I run the exe manually on the client the install works fine.
There must be a setting I haven't got right on the package in SMS.
Dan.
There must be a setting I haven't got right on the package in SMS.
Dan.
Posted by:
oofemioo
20 years ago
Posted by:
kuji2000
20 years ago
Posted by:
bbowen8
19 years ago
I have run into similar issues with trying to run batch files that call executables through SMS and would love to know of any other workarounds. I am currently working for a client who does not want to use the SMS Software Updates piece so were are stringing KB hotfix installs into one .BAT file. This actually does work, but whenever there is a problem with one of the hotfixes for a particular user, because the install is part of a batch file, the batch file just continues running and as long as the last line of the batch file is successful, SMS reports the whole install(s) as successful.
Here is an example of our script:
rem **Security Update KB896358 06-2005**
KB896358.exe /quiet /norestart
set exit=%errorlevel%
set failloc=2-KB896358
If NOT %exit% == 0 goto Fail
echo %failloc% installed successfully. >>C:\WINDOWS\system32\CCM\logs\Sec_Updates.log
So we are keeping a log file on the user's hard drive to track the success and failures (which works). The installs themselves do work a large majority of the time.
But at the end of our BAT file we have...
:Fail
echo %failloc% failed with error code %exit%. >>C:\WINDOWS\system32\CCM\logs\Sec_Updates.log
Rem Run qchain in case some updates have run
qchain.exe
exit /b %exit%
It's our understanding that the exit /b switch will force quit a BAT file and make it appear to SMS that the batch file has failed (which we want). We are also trying to pass SMS the errorlevel (our %exit% variable). But, we think, because the exit command actually succeeds, SMS thinks the whole batch file succeeded and returns a "Successful" install to the user.
How can we use BAT files to install multiple programs and error trap or pass errors to SMS? Others have told us Exit /B was the correct way to do this but it hasn't worked for us yet. Any help would be appreciated. Obviously we could create separate programs for each KB fix (or future combinations) but would like to avoid it if necessary.
Thanks,
Bill
Here is an example of our script:
rem **Security Update KB896358 06-2005**
KB896358.exe /quiet /norestart
set exit=%errorlevel%
set failloc=2-KB896358
If NOT %exit% == 0 goto Fail
echo %failloc% installed successfully. >>C:\WINDOWS\system32\CCM\logs\Sec_Updates.log
So we are keeping a log file on the user's hard drive to track the success and failures (which works). The installs themselves do work a large majority of the time.
But at the end of our BAT file we have...
:Fail
echo %failloc% failed with error code %exit%. >>C:\WINDOWS\system32\CCM\logs\Sec_Updates.log
Rem Run qchain in case some updates have run
qchain.exe
exit /b %exit%
It's our understanding that the exit /b switch will force quit a BAT file and make it appear to SMS that the batch file has failed (which we want). We are also trying to pass SMS the errorlevel (our %exit% variable). But, we think, because the exit command actually succeeds, SMS thinks the whole batch file succeeded and returns a "Successful" install to the user.
How can we use BAT files to install multiple programs and error trap or pass errors to SMS? Others have told us Exit /B was the correct way to do this but it hasn't worked for us yet. Any help would be appreciated. Obviously we could create separate programs for each KB fix (or future combinations) but would like to avoid it if necessary.
Thanks,
Bill
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.