How do I push a Batch file to a system?

(imported topic written by cthurman91)

I have 3 files in a folder:

A simple two line batch file which calls and runs (2) .exe files.

  1. Is using the deployment wizard the correct way to do the distribution of these files?

  2. The deployment wizard doesn’t seem to execute batch files, is there a better way to do this?

So I was thinking the deployment wizard would grab all the files in the folder and I could “select” the batch file to run and voila. Any assistance is greatly appreciated.

(imported comment written by MattBoyd)

I prefer to copy the contents of batch files and scripts into the action script rather than uploading them through the Software Distribution Wizard. That way, I can edit the script by editing the task, and I don’t have to re-upload the scripts every time I make a change. Including these files in action script is very simple using the createfile command:

createfile until ENDOFFILEMARKER   
//The contents of your bat file or script go here   ENDOFFILEMARKER 
//copy the newly-created file to a different file name copy __createfile yourbatfile.bat   
//execute your bat file or script dos yourbatfile.bat   
//delete the bat file in case the task gets run again (the copy command above will fail if the bat file already exists) delete yourbatfile.bat

The .exe files still need to bat uploaded via the software deployment wizard though…

(imported comment written by cthurman91)

OK. that seems easy enough, but I think I missed something. I need BES for dummies here. I mean, step 1

Step one: I’m logged into the console…

Step two: Click on what menu item…

Step three:

And, in what document did you find the information on how all of this works?

Thanks!

(imported comment written by BenKus)

Can you post your batch script contents… it might help give context on how to assist…

Thanks,

Ben

(imported comment written by cthurman91)

This is what I have so far. Everything works except, when the .bat file needs to kick off.

This is the script is below, between the double lines.

=========================================================================

=========================================================================

download http: // server.company.net:port/Uploads/03a97b388555316bde93e5a1e60b2ae127ba110c/browser-history.tmp

continue if {(size of it = 159784 AND sha1 of it = “03a97b388555316bde93e5a1e60b2ae127ba110c”) of file “browser-history.tmp” of folder “__Download”}

extract browser-history.tmp

if {exists current user}

wait C:\Program Files (x86)\BigFix Enterprise\BES Client__BESData\actionsite__Download\RunAsCurrentUser --w __Download\runme.bat

========================================================================

=========================================================================

RESULTS BELOW

========================================================================

========================================================================

Completed download http://server.company.net:port/Uploads/03a97b388555316bde93e5a1e60b2ae127ba110c/browser-history.tmp

Completed continue if {(size of it = 159784 AND sha1 of it = “03a97b388555316bde93e5a1e60b2ae127ba110c”) of file “browser-history.tmp” of folder “__Download”}

Completed extract browser-history.tmp

Completed if {exists current user}

Failed wait C:\Program Files (x86)\BigFix Enterprise\BES Client__BESData\actionsite__Download\RunAsCurrentUser --w __Download\runme.bat

=========================================================================

=========================================================================

(imported comment written by BenKus)

Make sure you use quotes for long paths… and the relative path should work fine:

download http: // server.company.net:port/Uploads/03a97b388555316bde93e5a1e60b2ae127ba110c/browser-history.tmp
continue if {(size of it = 159784 AND sha1 of it = “03a97b388555316bde93e5a1e60b2ae127ba110c”) of file “browser-history.tmp” of folder “__Download”}

extract browser-history.tmp

if {exists current user}
wait __Download\RunAsCurrentUser --w cmd.exe /C __Download\runme.bat
endif

You can also just add “exists current user” to the relevance so it would never run unless a user was logged in…

If it doesn’t work, please post the contents of “runme.bat”…

Ben

(imported comment written by JackCoates91)

you can also make it a little easier to read by using prefetch (http://forum.bigfix.com/viewtopic.php?pid=20675)

prefetch browser-history.tmp sha1:03a97b388555316bde93e5a1e60b2ae127ba110c size:159784 http://server.company.net:port/Uploads/03a97b388555316bde93e5a1e60b2ae127ba110c/browser-history.tmp

(imported comment written by tscott91)

I’ve learned a lot from this thread. Thanks Ben for the idea of using the manual action script couple with the software wizard…

However, here’s the issue I am having… Here is my code:

download http:
//PATCH-FS.fpbank.fpfc.net:52311/Uploads/da37e75b7b4f5508fa40af317575edd4e652cf63/OOo_3.2.1_Win_x86_install-wJRE_en-US.tmp 

continue 

if 
{(size of it = 154859166 AND sha1 of it = 
"da37e75b7b4f5508fa40af317575edd4e652cf63") of file 
"OOo_3.2.1_Win_x86_install-wJRE_en-US.tmp" of folder 
"__Download"
}   extract OOo_3.2.1_Win_x86_install-wJRE_en-US.tmp   createfile until ENDOFFILEMARKER   start /wait msiexec /qn /norestart /i openofficeorg32.msi ADDLOCAL=ALL REMOVE=gm_p_Base,gm_p_Base_Bin,gm_p_Draw,gm_p_Draw_Bin,gm_p_Math,gm_p_Math_Bin,gm_o_Onlineupdate PAUSE del 
"C:\Documents and Settings\All USers\Desktop\OpenOffice.org 3.2.lnk" copy 
"mods\Setup-impress.xcu" 
"C:\Program Files\OpenOffice.org 3\Basis\share\registry\modules\org\openoffice\Setup" /y copy 
"mods\Setup-calc.xcu" 
"C:\Program Files\OpenOffice.org 3\Basis\share\registry\modules\org\openoffice\Setup" /y copy 
"mods\Setup-writer.xcu" 
"C:\Program Files\OpenOffice.org 3\Basis\share\registry\modules\org\openoffice\Setup" /y del 
"C:\Program Files\OpenOffice.org 3\Program\soffice.ini" copy 
"mods\Soffice.ini" 
"C:\Program Files\OpenOffice.org 3\program" /y copy 
"mods\DisableFirstStartWzd_ooo321.oxt" 
"C:\Program Files\OpenOffice.org 3\Program" /y 
"C:\Program Files\OpenOffice.org 3\Program\unopkg" add --shared 
"C:\Program Files\OpenOffice.org 3\Program\DisableFirstStartWzd_ooo321.oxt"   ENDOFFILEMARKER 
//copy the newly-created file to a different file name copy __createfile 
"__Download\InstallOO.bat"   
//execute your bat file or script wait 
"{pathname of system folder & "\cmd.exe
"}" /C 
"{(pathname of client folder of current site) & "\__Download\InstallOO.bat
"}"   
//delete the bat file in case the task gets run again (the copy command above will fail if the bat file already exists) delete 
"__Download\InstallOO.bat"

The problem is… It is running the first command “start /wait msiexec /qn /norestart /i openofficeorg32.msi ADDLOCAL=ALL REMOVE=gm_p_Base,gm_p_Base_Bin,gm_p_Draw,gm_p_Draw_Bin,gm_p_Math,gm_p_Math_Bin,gm_o_Onlineupdate” from “C:\Program Files\BigFix Enterprise\BES Client__BESData\actionsite” and all the files are located in “C:\Program Files\BigFix Enterprise\BES Client__BESData\actionsite__Download”…

Any ideas? Thanks!

(imported comment written by tscott91)

Got it fixed thanks for some help from support…

download http:
//PATCH-FS.fpbank.fpfc.net:52311/Uploads/da37e75b7b4f5508fa40af317575edd4e652cf63/OOo_3.2.1_Win_x86_install-wJRE_en-US.tmp 

continue 

if 
{(size of it = 154859166 AND sha1 of it = 
"da37e75b7b4f5508fa40af317575edd4e652cf63") of file 
"OOo_3.2.1_Win_x86_install-wJRE_en-US.tmp" of folder 
"__Download"
}   extract OOo_3.2.1_Win_x86_install-wJRE_en-US.tmp   delete __appendfile delete 
"__Download\InstallOO.Bat"   appendfile cd 
"{pathname of parent folder of regapp "BESClient.exe
" & "\__BESData\actionsite\__Download
"}" appendfile start /wait msiexec /qn /norestart /i openofficeorg32.msi ADDLOCAL=ALL REMOVE=gm_p_Base,gm_p_Base_Bin,gm_p_Draw,gm_p_Draw_Bin,gm_p_Math,gm_p_Math_Bin,gm_o_Onlineupdate appendfile del 
"C:\Documents and Settings\All USers\Desktop\OpenOffice.org 3.2.lnk" appendfile copy 
"mods\Setup-impress.xcu" 
"C:\Program Files\OpenOffice.org 3\Basis\share\registry\modules\org\openoffice\Setup" /y appendfile copy 
"mods\Setup-calc.xcu" 
"C:\Program Files\OpenOffice.org 3\Basis\share\registry\modules\org\openoffice\Setup" /y appendfile copy 
"mods\Setup-writer.xcu" 
"C:\Program Files\OpenOffice.org 3\Basis\share\registry\modules\org\openoffice\Setup" /y appendfile del 
"C:\Program Files\OpenOffice.org 3\Program\soffice.ini" appendfile copy 
"mods\Soffice.ini" 
"C:\Program Files\OpenOffice.org 3\program" /y appendfile copy 
"mods\DisableFirstStartWzd_ooo321.oxt" 
"C:\Program Files\OpenOffice.org 3\Program" /y appendfile 
"C:\Program Files\OpenOffice.org 3\Program\unopkg" add --shared 
"C:\Program Files\OpenOffice.org 3\Program\DisableFirstStartWzd_ooo321.oxt"   
//copy the newly-created file to a different file name copy __appendfile 
"__Download\InstallOO.bat"   
//execute your bat file or script waithidden 
"{pathname of system folder & "\cmd.exe
"}" /C 
"{(pathname of client folder of current site) & "\__Download\InstallOO.bat
"}"   
//delete the bat file in case the task gets run again (the copy command above will fail if the bat file already exists) delete 
"__Download\InstallOO.bat"