Jump to content


Kops

Push a batch script to collection

Recommended Posts

We have deployed an .msi application to about 400 PCs that consists of 5 small programs. We don't want end users to have access to 1 of the 5 programs (which is essentially the 'config' for the other 4 programs), but unfortunately there are no switches that will allow me to only install the programs I want.

 

I have been asked to remove all traces of the 'config' program, which I have accomplished by removing the executable and all links to it with a simple batch script

CD C:\Users\Public\Desktop
del "DFSystem 4.3.lnk"

CD C:\ProgramData\Microsoft\Windows\Start Menu\Programs\DataFax 4.3
del "DFSystem.lnk"

CD C:\Program Files (x86)\Clinical DataFax Systems Inc\DataFax 4.3
del "DFSystem.exe" 

This works exactly as intended if ran on my local PC. My question now is, whats the best way to push this to all devices in a collection? I have placed the .bat script on my DP, and have created a required package that uses command line to run Remove_DFSystem43.bat. I'm not sure that this is functioning properly though, as when I deploy it to the Test-Device-Collection (only my PC), Compliance will say 100% after a couple minutes but the executable and links still remain, leading me to believe that I haven't pushed it out correctly.

 

Any advice on how to push a .bat script to a device collection?

 

 

 

Share this post


Link to post
Share on other sites

I think your method/logic is fine (using a package to run a batch file.) It's likely that while your batch file works fine locally, it's not executing properly through SCCM. And it may say 100% compliant because the program itself executed...the batch just didn't work as expected.

 

I would look more closely at the placement of quotes in your batch script. It looks to me like there are some spaces in there, where more quotes would be required for remote execution of the script.

 

CD C:\Users\Public\Desktop

del "DFSystem 4.3.lnk"

 

CD "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\DataFax 4.3"

del "DFSystem.lnk"

 

CD "C:\Program Files (x86)\Clinical DataFax Systems Inc\DataFax 4.3"

del "DFSystem.exe"

 

Hope this gets you on the right track.

Share this post


Link to post
Share on other sites

I think your method/logic is fine (using a package to run a batch file.) It's likely that while your batch file works fine locally, it's not executing properly through SCCM. And it may say 100% compliant because the program itself executed...the batch just didn't work as expected.

 

I would look more closely at the placement of quotes in your batch script. It looks to me like there are some spaces in there, where more quotes would be required for remote execution of the script.

 

CD C:\Users\Public\Desktop

del "DFSystem 4.3.lnk"

 

CD "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\DataFax 4.3"

del "DFSystem.lnk"

 

CD "C:\Program Files (x86)\Clinical DataFax Systems Inc\DataFax 4.3"

del "DFSystem.exe"

 

Hope this gets you on the right track.

Share this post


Link to post
Share on other sites

Just create an MST file (with Admin Studio or even Orca) to remove the file and the links druring the Installation.

If the components are indexed in the msi and the other links are advertised, the msi will be repaired with every program start and the items will be back. This will also spare you the additional application. It's just unnecessary overhead.

Share this post


Link to post
Share on other sites

Thanks for the input guys! I have edited the script to use proper quotations, and while I think this is much better scripting practice, I am still experiencing some issues. Here is my process:

 

  • Create Remove_Shortcuts.bat
    CD "C:\Users\Public\Desktop"
    del "DFSystem 4.3.lnk"
    
    CD "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\DataFax 4.3"
    del "DFSystem.lnk"
    
    CD "C:\Program Files (x86)\Clinical DataFax Systems Inc\DataFax 4.3"
    del "DFSystem.exe"
    
    
  • Create folder ..\sources\DataFax and copy the .bat to this location

  • Create new package with the following options

    - This package contains source files and point to location where I put m script ...\sources\DataFax
    - Distribution priority (have tried a few options) currently at medium

  • Create new program with the following options
    - Command Line: Browsed to ..\sources\DataFax directory and selected the Remove_Shortcuts.bat
    - Start In: blank
    - Run: minimized
    - After running: no action required
    - Requirements: any platform
    - Environment: program can run whether or not user is logged in
    - Run Mode: Run with administrative rights
    - Drive Mode: Requires drive letter (have tried all 3 options)

  • Create a new deployment and deploy to a User collection (only my user account) with the following options
    - Action: Install, Purpose: Available (so I can attempt to run this from application catalog)
    - Schedule: none
    - User Experience: Allow software installation/system restart if outside of maintenance window
    - Deployment Options: Download content from distribution point and run locally (best for batch scripts I would imagine)

 

I then navigate to the CMApplicationCatalog, find the package, and click install. I flip over to the Software Center and it says 'Installed' yet all the shortcuts still exist :(

 

Any ideas? Can I post any logs that might help?

Share this post


Link to post
Share on other sites

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...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.