Windows Software Distribution Wizard (Launch BAT)

(imported topic written by RobertDiRosato)

What is the syntax for launching a bat file from the Windows Software Distribution Wizard in BigFix?

Say I upload a structure like this using the wizard and I include subfolders…

FOLDER - 32BIT

FOLDER - 64BIT

FILE - setup.bat

I tried:

Setup.bat

Setup.bat /C

CMD.exe Setup.bat

cmd.exe /c Setup.bat

What is the right Syntax?

See attached screenshot

Thanks in advance for your help

(imported comment written by RobertDiRosato)

Also here is what the bat file looks like

@Echo Off

If exist C:“Program Files (x86)” GOTO 64BIT

if not exist C:“Program Files (x86)” GOTO 32BIT

:64BIT

64\LyncSetup.exe /install /silent

GOTO ENDSCRIPT

:32BIT

32\LyncSetup.exe /install /silent

GOTO ENDSCRIPT

:ENDSCRIPT

EXIT

(imported comment written by MattBoyd)

For small bat files like this one, it’s probably just as easy to create and then execute the bat file using action script, like this:

createfile until ENDOFFILEMARKER @Echo Off If exist C:\
"Program Files (x86)" GOTO 64BIT 

if not exist C:\
"Program Files (x86)" GOTO 32BIT   :64BIT 64\LyncSetup.exe /install /silent GOTO ENDSCRIPT   :32BIT 32\LyncSetup.exe /install /silent GOTO ENDSCRIPT   :ENDSCRIPT EXIT ENDOFFILEMARKER   delete LyncSetup.bat copy __createfile LyncSetup.bat waithidden LyncSetup.bat

This makes it a lot easier in the event that you need to perform an edit on the bat file, since you can just edit the action script instead of uploading the file through the wizard again. Oh, and because this is checking for 32 or 64 bit, you’ll want to disable Wow6432 redirection by putting this line at the beginning of the action:

{code}

action uses wow64 redirection false

{/code}

(imported comment written by RobertDiRosato)

Matt,

Thanks for the reply…

Was kind of hoping for the command to run on the distribution wizard side…

I have alot of packages that need to be deployed and in the documentation it says it works with bat files

(imported comment written by MattBoyd)

You should be able to use something like this:

waithidden __Download\Setup.bat

For actual dos commands (copy, mkdir, del) you can also use this:

dos __Download\Setup.bat

(imported comment written by RobertDiRosato)

I attached a screenshot so you can see where I need the command.

See attached I highlighted in Yellow

I really need the answer to this I have been googling all day

Thanks again for your help

I used to do all this through the Manage Software Distributions Dashboard but for some reason it never uploads the files anymore…

But that is a question for another day…

(imported comment written by RobertDiRosato)

Sorry I uploaded the wrong picture…

This is the correct one…

(imported comment written by Zakkus)

Hey Robert,

There might be a bug with this wizard. it seems to toss that error whenever you have a file in the command that ends in “.bat”.

The simplest work around would be to just have your command line be “Setup.ba” (no need for the “wait” or anything like that, since the wizard will try to set that itself), and once you hit the “finish” button, the final “Create Task” window will pop up which lets you make any custom edits you want. Here you can go to the action and add the “t”.

However, as the other stated, if you want to deploy a .bat file, you dont really need the software distribution wizard. This wizard is more for deploying out large installer files, if you just want to push out a small custom script like that, you can do what MattBoyd suggested and just create a custom task that creates the .bat on the fly, and then runs it.

-Zak

(imported comment written by RobertDiRosato)

Thanks for the response.

Let me try to explain this a little better.

BigFix Has a software distribution wizard

This wizard in the documentation is said to launch exe, bat, msi files

I would like to use this wizard to deploy pre-existing packages.

It works for my exe files with switches to my custom xml files no problem…

For a bat file but it will not execute the bat commands…

Here is all I want to do through SWD…

Upload 2 folders & 1 file

From All Content > Wizards > All Wizards > Windows Software Distribution Wizard

(Here is all the package will contain)

32bit <- Folder (32bit files)

64bit <- Folder (64bit Files)

Setup.bat <- File (Code to install and determine bit)

So I want to upload the above…

have it create a task with all the files…

and when that task is deployed it executes the code in the bat file…

IS IT POSSIBLE TO LAUNCH A BAT THIS WAY IF SO WHAT IS THE SYNTANX I WOULD PLACE IN THE ATTACHED SCREENSHOT

Also again here is the data that the bat file contains… it’s very simple…

In my other packages the bat files are not so simple…

If exist C:“Program Files (x86)” GOTO 64BIT

if not exist C:“Program Files (x86)” GOTO 32BIT

:64BIT

64\LyncSetup.exe /install /silent

GOTO ENDSCRIPT

:32BIT

32\LyncSetup.exe /install /silent

GOTO ENDSCRIPT

:ENDSCRIPT

(imported comment written by RobertDiRosato)

When I run the above after creating the package in SWD the bat commands do not execute.

Am I in the wrong directory?

In the GUI I set it to Setup.exe and after it’s created I change EXE to BAT in the action script…

Please help

(imported comment written by Zakkus)

There is a bug with how the wizard treats .bat files, so if you have “.bat” in the command line string it will pop up that message.

To get around this, just put “setup.ba” in the prompt of the command line. Once you hit finish, you will see a “Create Task” dialog like the one in my screen shot. just add the “t” back in the action, and everything should work fine. You can also make any other custom edits your want here.

The commands are run form operator folder in the bes client directory, most likely “C:\Program Files (x86)\BigFix Enterprise\BES Client__BESData\actionsite”. The files are downloaded to the “__Download” folder in that same path. All your commands should be in that context. I may be misunderstanding what you are trying to do, but it looks like your .bat file doesn’t ever really reference the files you are downloading.

-Zak

(imported comment written by Zakkus)

Also, you might be interested in our full Software Distribution solution, which is a site that has more advanced software distribution creation and management content:

http://publib.boulder.ibm.com/infocenter/tivihelp/v26r1/index.jsp?topic=%2Fcom.ibm.tem.doc_8.2%2FLifecycle_Man%2FSWD_Users_Guide%2Fc_introduction.html

(imported comment written by RobertDiRosato)

I have 'em BigFix

BigFix Deploy em much software

I make bat

Call bat ba

Add “T” in action

BAT no execute on client

Me thinks em path issue…

This might work I am going to try now…

CHANGE TO PROPER DIRECTORY

32-BIT

CD C:“Program Files”“BigFix Enterprise”“BES Client”__BESData\actionsite__Download

64-BIT

C:\Program Files (x86)\BigFix Enterprise\BES Client__BESData\actionsite__Download

(imported comment written by RobertDiRosato)

Thanks ZAKKUS for pointing me in the right direction

How to execute a package with .bat commands in BigFix

  • Open the BigFix Console
  • Select All Content
  • Select Wizards
  • Select All Wizards
  • Select Windows Software Distribution Wizard
  • Enter the name of your Package
  • Click Next
  • Select Folder
  • Select Include Subfolders
  • Click Browse
  • Find and Highlight your folder
  • Click OK
  • Click Next
  • Click Next
  • Click Next
  • Enter the name of your Bat file leave off the T in bat

Ex. Setup.ba

  • Click Next
  • Click Finish
  • Click the Actions Tab
  • On the last line wait __Download\Setup.ba <- Add the T

Ex. wait __Download\Setup.baT

  • At the top verify the Name field is to your liking
  • Click OK
  • Enter your password
  • Click OK
  • Give the task sometime to poll your endpoints… or use the send refresh command

For this example my package contains 2 folders & 1 bat file

32 <- Folder

64 <- Folder

Setup.bat <- File

My Setup.bat executes data from the 2 folders within the same package.

A Relative path will not work you need to add an Absolute path in your bat file as shown below.

REM

If exist C:“Program Files (x86)” GOTO 64BIT

if not exist C:“Program Files (x86)” GOTO 32BIT

:64BIT

CD C:\Program Files (x86)\BigFix Enterprise\BES Client__BESData\actionsite__Download

64\LyncSetup.exe /install /silent

GOTO ENDSCRIPT

:32BIT

CD C:“Program Files”“BigFix Enterprise”“BES Client”__BESData\actionsite__Download

32\LyncSetup.exe /install /silent

GOTO ENDSCRIPT

:ENDSCRIPT

REM

  • From the BigFix Console
  • Select Fixlets & Tasks
  • In the search box to left enter your task name
  • Click Search
  • Highlight your Task
  • Click Take Action
  • Select Applicable Endpoints
  • Click OK
  • At the top verify the Name field is to your liking
  • Click OK
  • Click OK
  • Enter your password
  • Click OK
  • Wait till action completes
  • Login to endpoint to verify install was a success
1 Like