locked
Running a batch file to copy files using sccm. RRS feed

  • Question

  • I have looked over all suggestions here and cannot figure out what is going on. I want to deploy a simple batch file to copy 3 files over to 500 computers using SCCM. I can run it from sccm in the run command and it copies the files fine but when i try to deploy it, it either fails or waiting for content. When it fails I am running it from the distribution point and when it is waiting for content I am downloading it from dp and running it locally. It is driving me crazy. Below is the bat file used with the command line cmd /c test.bat

    copy /y %~dp0deployment.config "C:\Windows\Sun\Java\Deployment"
    copy /y %~dp0deployment.properties "C:\Windows\Sun\Java\Deployment"
    copy /y %~dp0trusted.certs "C:\Program Files\Java\jre6\lib\security"

     


    Kathy Wingfield
    • Edited by Kat7881 Monday, September 19, 2011 8:07 PM
    Monday, September 19, 2011 8:06 PM

Answers

  • I think one of reasons the package is stuck “waiting on content” (when you choose download and execute option) is that the package looks like it contains a file with *.config extension. IIS will block certain file extensions and so you would need to modify the <requestFiltering> section in the applicationHost.config on each Distribution Point (after making a backup of this file). This is described here http://technet.microsoft.com/en-us/library/cc431377.aspx#Config_RequestFiltering  and set (  <add fileExtension=".config" allowed="true" /> )

    Do the status messages for the relevant advert give any error code? It would be worth verifying that the batch file works when you run it via the SYSTEM account using psexec http://technet.microsoft.com/en-us/sysinternals/bb897553  (e.g. getting a command prompt via psexec  –sid cmd.exe and then running the batch file). I think you should be able to call the batch file directly without “cmd /c” (this is typically required where you want to use some MS-DOS command, like copy).  Also, are these x64 or x86 clients? You may consider it too much work for one instance but in the long run reworking this kind of thing into some form of vb script (which you can then reuse) to add more logic and logging to catch simple errors (e.g. finding out whether folder C:\Windows\Sun\Java\Deployment exists on the client machine before attempting to copy files to it).

    • Marked as answer by Kat7881 Tuesday, September 20, 2011 8:00 PM
    Tuesday, September 20, 2011 10:17 AM

All replies

  • have you seen the below thread?

    Pls check out, detailed discussion

    http://social.technet.microsoft.com/Forums/en-US/configmgrgeneral/thread/c0247830-d0ef-4133-a8a0-c0f44afe56ef


    Anoop C Nair - Twitter @anoopmannur

    MY BLOG:  http://anoopmannur.wordpress.com

    SCCM Professionals

    This posting is provided AS-IS with no warranties/guarantees and confers no rights.

    Monday, September 19, 2011 8:11 PM
  • I have chacked out all the threads on here dealing with batch files. The one is has to do with VBS scripts. I have checked all my settings per recommendations and my script and still cannot get it to work via SCCM.
    Kathy Wingfield
    Monday, September 19, 2011 8:53 PM
  • I think one of reasons the package is stuck “waiting on content” (when you choose download and execute option) is that the package looks like it contains a file with *.config extension. IIS will block certain file extensions and so you would need to modify the <requestFiltering> section in the applicationHost.config on each Distribution Point (after making a backup of this file). This is described here http://technet.microsoft.com/en-us/library/cc431377.aspx#Config_RequestFiltering  and set (  <add fileExtension=".config" allowed="true" /> )

    Do the status messages for the relevant advert give any error code? It would be worth verifying that the batch file works when you run it via the SYSTEM account using psexec http://technet.microsoft.com/en-us/sysinternals/bb897553  (e.g. getting a command prompt via psexec  –sid cmd.exe and then running the batch file). I think you should be able to call the batch file directly without “cmd /c” (this is typically required where you want to use some MS-DOS command, like copy).  Also, are these x64 or x86 clients? You may consider it too much work for one instance but in the long run reworking this kind of thing into some form of vb script (which you can then reuse) to add more logic and logging to catch simple errors (e.g. finding out whether folder C:\Windows\Sun\Java\Deployment exists on the client machine before attempting to copy files to it).

    • Marked as answer by Kat7881 Tuesday, September 20, 2011 8:00 PM
    Tuesday, September 20, 2011 10:17 AM
  • you can create a batch/cmd file with below command prompt to copy files using SCCM.I have placed files in files-to-be-copied which is child of Files folder.

    cerate a folder XXX and place all the files needs to be copied onto destination computer folder. Create a batch/cmd file with command line syntax : This will copy all the files avilable from the current folder to desntiantion computer C:\program files...

    COPY /Y "%~dps0*.*" "C:\Program Files\Yyyy"
    REM Yyyy is destination folder name

    program command line to be used CopyFiles.cmd with data source path above with files avilable.

    Or check out this thread with VB script http://social.technet.microsoft.com/Forums/en/ITCG/thread/0fe62945-683f-4e0f-bf28-b27d4830831e


    //Eswar Koneti @ www.eskonr.com
    Tuesday, September 20, 2011 10:45 AM
  • Thank you Samuel this worked.
    Kathy Wingfield
    Tuesday, September 20, 2011 8:00 PM
  • I recently read a post in a Windows Server Forum that suggested the use of Batch files to handle a login tracking function. Now days people would just go buy an application to handle something like that.   Not only was this a throwback to the 90’s hay day of DOS 5 and 6, but it was also nostalgic to see someone recommending an old school solution to a modern problem. 

    Inspired to do some research, I have listed some pretty cool Batch File Sites below.  Hopefully you too will remember when batch files were the bomb.

    http://www.dostips.com/DtCodeBatchFiles.php#Batch.Progress

    http://www.robvanderwoude.com/batexamples.php

    http://www.scriptcode.com/help/batch-file-examples.html

    Friday, February 24, 2012 10:56 PM