Installing a .bat file

Hi,

I could use some help with this one. I’m trying to make a fixlet that downloads a .bat file from the bigfix server to a computer and runs it. I’ve tested the .bat file and it works great but the fixlet fails to run it on the computer. Could someone give me some insight on what I might have done wrong here.

Thank you.

//**Begin Preparation Marker
// Download all specified files
begin prefetch block
add prefetch item name=2bd99bf6a150d7ed1e07bb13e3f8c51694742c5e sha1=2bd99bf6a150d7ed1e07bb13e3f8c51694742c5e size=424 url=SWDProtocol://127.0.0.1:52311/Uploads/2bd99bf6a150d7ed1e07bb13e3f8c51694742c5e/GalterPrinterInstall.bat.bfswd sha256=ff18924b4cb528fc5984a8c9ffa4606edf6c5921eb758de25802c7054565f5e6
end prefetch block

// All SWD files will go into a folder in the clients __BESData folder. This folder gets cleared on every restart.
parameter “baseFolder” = “__Download/”
// Move files into subfolders and unescape file names
move “__Download/2bd99bf6a150d7ed1e07bb13e3f8c51694742c5e” “{parameter “baseFolder”}GalterPrinterInstall.bat”

override wait
hidden=true
RunAs=currentuser
wait “__Download\GalterPrinterInstall.bat”

Check Tip - Action Override User settings
specifically the first bullet under ‘Considerations’. If you’re going to use ‘RunAs=currentuser’, you need to first move the batch file to a path the user can access (by default only Administrators can access the __BESData folder).

The next thing to check is whether this runs correctly in 32-bit mode. To run in 64-bit mode, add

action uses wow64 redirection false
on any line before the ‘override’ command.

1 Like

Alright so trying to download and run the .bat file keeps failing or if it does complete nothing actually gets run on the computer. I’ve switched tactics to just make the .bat in a fixlet and then run it on the computer. Everything completes successfully but when the .bat runs it just runs forever and never resolves. Again any help and insight here would be welcomed. Maybe I’m overcomplicating things and there’s an easier way to do this.

parameter “mainSWDLogFolder” = "{parent folder of client folder of current site}/__Global/SWDDeployData"
folder create "{parameter “mainSWDLogFolder”}"
parameter “logFile” = “SWD_DeploymentResults.log”

//**End Preparation Marker
delete __createfile
parameter “logFolder” = “{parameter “mainSWDLogFolder”}”
// Run setup process
delete run.bat

// Use .bat to set working directory to packages root, for setup command.
createfile until end
@ECHO OFF
rundll32 printui.dll,PrintUIEntry /q /in /n “\nwu-app-svr.ads.northwestern.edu\StudentPay-BW-Duplex”

rundll32 printui.dll,PrintUIEntry /q /in /n “\nwu-app-svr.ads.northwestern.edu\StudentPay-BW-Simplex”

rundll32 printui.dll,PrintUIEntry /q /in /n “\nwu-app-svr.ads.northwestern.edu\StudentPay-Color-Duplex”

rundll32 printui.dll,PrintUIEntry /q /in /n "\nwu-app-svr.ads.northwestern.edu\StudentPay-Color-Simplex"
end

move __createfile run.bat
// You will not be able to stop or take action on an applicable BigFix Client until your installer completes.
// So ensure no user input is required.
// If your package absolutely must interact with the user, replace ‘override wait’ with ‘override run’ and ‘wait’ with ‘run’.
action uses wow64 redirection false
override wait
hidden=true
completion=job
wait run.bat

//**Begin Closing Marker
// Get the return code of the previous action.
parameter “returnCode” = “{exit code of action}”

// Task will now exit.
exit {parameter “returnCode”}
//**End Closing Marker

Not really familiar with this method, but does it create any pop-up dialogs that have to be acknowledged? Since the interface is hidden those windows won’t be visible.
You may have better luck with the prnmgr.vbs scripts
https://ss64.com/nt/prnmngr.html#:~:text=vbs,or%20set%20the%20default%20printer.&text=All%20recent%20versions%20of%20Windows,printer%20management%20enabled%20by%20default.