Run Bat File

(imported topic written by SystemAdmin)

Dear All,

I am newbie in BigFix as i am covering for My Team Mate who is on annual leave.

i am trying to run .bat file using the below code, result is success but bat file is not being executed .

download http://172.24.96.76:52311/Uploads/d55d8e853eecc4ff86b50c404e9da1764bb39aa8/Startbat.tmp

continue if {(size of it = 654 AND sha1 of it = “d55d8e853eecc4ff86b50c404e9da1764bb39aa8”) of file “Startbat.tmp” of folder “__Download”}

extract Startbat.tmp

//wait “{pathname of system folder & “\cmd.exe”}” /Q /C “{(pathname of client folder of current site) & “__Download\Start.bat”}”

waithidden cmd.exe /C "__Download\Start.bat

bat file code is

@echo off

@title “Script for PM tool kit”

@echo off

cls

start \fileserver001\ITservice\SDS\PMNewScript\PM_before.vbs

Echo " Start the PM Engineer toolkit"

ping -n 20 172.0.0.1 >NUl

cd /d %userprofile%\Desktop\EngineerToolKit

Echo " copying report to the server …"

copy

.

\fileserver001\ITservice\SDS\PMNewScript\Report

Echo “Deleting Temp Files… Please Wait”

cd /d %userprofile%\Local Settings\temp

del /Q

.

start \fileserver001\ITservice\SDS\PMNewScript\clearcache.exe /s

Echo “Cleaned Temp files…”

start \fileserver001\ITservice\SDS\PMNewScript\AutomaticUpdates.vbs /s

Echo “The Automatic Updates service has been started”

start \fileserver001\ITservice\SDS\PMNewScript\DelRequiredFiles.vbs /s

Echo “Sucessfully Deleted the IE Temp file”

start \fileserver001\ITservice\SDS\PMNewScript\SymantecAntivirusDef.vbs /s

Echo "The Symantec Antivirus Definition service has been started "

start \fileserver001\ITservice\SDS\PMNewScript\BITS.vbs /s

Echo "The Background Intelligent Transfer Service has been started "

start \fileserver001\ITservice\SDS\PMNewScript\EnableCookies.vbs /s

Echo "Self Service completed, Enabled cookies "

start \fileserver001\ITservice\SDS\PMNewScript\SymantecEventManager.vbs /s

Echo "Your Symantec Antivirus Event Manager service has been started "

start \fileserver001\ITservice\SDS\PMNewScript\Spooler.vbs /s

Echo "The Print Spooler service has been started "

start \fileserver001\ITservice\SDS\PMNewScript\SystemMemory.vbs /s

Echo "done "

start \fileserver001\ITservice\SDS\PMNewScript\SymantecAntivirus.vbs /s

Echo "The Symantec AntiVirus service has been started "

start \fileserver001\ITservice\SDS\PMNewScript\tempclear.vbs /s

Echo "Deleted Temporary files "

start \fileserver001\ITservice\SDS\PMNewScript\PM_after.vbs

Echo " Start the PM Engineer toolkit"

ping -n 20 172.0.0.1 >NUl

cd /d %userprofile%\Desktop\EngineerToolKit

Echo " copying report to the server …"

copy

.

\fileserver001\ITservice\SDS\PMNewScript\Report

exit

kindly assist .

(imported comment written by SystemAdmin)

just want to add that the bat file is working without issue if i ran locally…

i’ve tried to run the script in the below method as well .

download http://172.24.96.76:52311/Uploads/d55d8e853eecc4ff86b50c404e9da1764bb39aa8/Startbat.tmp

continue if {(size of it = 654 AND sha1 of it = “d55d8e853eecc4ff86b50c404e9da1764bb39aa8”) of file “Startbat.tmp” of folder “__Download”}

extract Startbat.tmp

//wait “{pathname of system folder & “\cmd.exe”}” /Q /C “{(pathname of client folder of current site) & “__Download\Start.bat”}”

waithidden cmd.exe /C "__Download\Start.bat

also same result completed but bat file is not deployed .

i tried to copy the vb script directly into Big fix but again same earlier result .

(imported comment written by JackCoates91)

you should wrap that with runascurrentuser.exe – the bat is trying to download files from a network share, but it’s running as localsystem and that won’t work.

(imported comment written by BenKus)

Looks like there is also a missing double-quote on after start.bat.

(and here is a KB article with more info on accessing shares: http://support.bigfix.com/cgi-bin/kbdirect.pl?id=1249)

Ben