SCCM Batch File Question
I need to replace a file (RPSSMenu.exe) on client machines that are depicted as a server in the environment variable we created for machinerole, however before
we can replace that file we need to kill a couple services. I was previously directed to create a package with the new file (RPSSMenu.exe) and a batch file (RGS-PreRun.bat) that will kill the services then copy the new file to the destination we need.
The problem I apparently have is the batch file I created is not correct:
@REM Pre Run Batch File
SET LOGFILE=D:\RGS\DATA\RGSBOFFICE.LOG
if %MACHINEROLE%==SERVER (
kill -F ApplicationServ
kill -F rpssmenu.exe
)
ECHO Copying RpssMenu.exe >> %LOGFILE%
copy "%~dp0rpssmenu.exe" "d:\rgs\bin\" /y >> %LOGFILE%
exit
Since SCCM copies the files to a random generated folder in the cache I can't put a static location in the statement to copy from and therefore was given
"%~dp0" to use. If this is not correct and/or there is another best practice to use please do share with me.
Thanks in advance for any light you can shed on this!
May 17th, 2010 10:38pm
Hi,
You should take a close look at this great post by Jason -
http://blogs.catapultsystems.com/jsandys/archive/2009/08/30/current-directory-in-configmgr-programs.aspx
Kent Agerlund | http://scug.dk/members/Agerlund/default.aspx | The Danish community for System Center products
Free Windows Admin Tool Kit Click here and download it now
May 17th, 2010 10:51pm