Skip to content

Deploy bat file with SCCM 2012

Featured Replies

Hello, this is my first post and I am glad to join windows-noob forum. I am a noob and new to SCCM and I hope I will find some help here.

 

I am having troubles deploying a simple batch script that will remove some installations.

 

Content of the script:

@echo off

::Silent remove openedge 10.1B
"C:\Program Files\InstallShield Installation Information\{874D5CE4-F913-4D5B-A6D4-CC129785B5C8}\setup.exe" /s /f1\\srvsccm01\sources$\Uninstall\proalpha5.1\add.iss /Z /Q

::Silent remove proalpha 5.1
MsiExec.exe /X{09FD2FA3-330F-4E8A-BF33-078C8B5D1032} /qn

::Silent remove proalpha Analyzer 7.0
MsiExec.exe /X{D8BF41E2-D1C0-4A85-9DE9-D16675FA904C} /qn

 

If I copy the bat file to a client and run it locally it will work 100%.

 

This is what I did on my SCCM.

- I have copied the bat file to the sccm server: \\srvsccm01\sources$\proALPHA5.2\pa-client-silent.bat

- Created a new package with the source files mentioned above

- In command line window I just selected my bat file from the above location.

- configured to run it with UNC name

 

Then I deployed it to my test machine with the option: Download content from distribution point and run locally.

However it will not work. SCCM will tell me that the deployment was succesful and 100% compliance but the script is not running.

I can easily deploy MSI applications and it will work.

I think my issue here is working with UNC paths in bath file.

 

Can someone help me?

 

Try setting the deployment to run from the distribution point, rather than download locally

  • Author

@Apexes Already tried, but not working.

 

@wilbywilson Can you edit my script using the variable? I really don't know how to use it.

Why are you not including the iss file to your package and copy it to c:\windows\temp or something like that?

You are trying to access a share with a local system account when you run the script like that. Never a good idea.

@echo off

::Silent remove openedge 10.1B
"C:\Program Files\InstallShield Installation Information\{874D5CE4-F913-4D5B-A6D4-CC129785B5C8}\setup.exe" /s /f1"%~dp0add.iss" /Z /Q

::Silent remove proalpha 5.1
MsiExec.exe /X{09FD2FA3-330F-4E8A-BF33-078C8B5D1032} /qn

::Silent remove proalpha Analyzer 7.0
MsiExec.exe /X{D8BF41E2-D1C0-4A85-9DE9-D16675FA904C} /qn

Well the %~dp0 is probably the better and easier way. Just copy the iss to your package source folder, like you did with the batch, edit the batch file, and update your Distribution Points.

  • Author

@Peter That worked like charm:) Thanks a lot! %~dp0 is a life saver.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.