Welcome to the Blogcast Repository Sign in | Join | Help
Search BlogCastRepository.com for:
in Search

246 BlogCasts in The BlogCast Repository!

Deploying A BAT File

Last post 10-08-2008 1:25 PM by Gabriel. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 09-18-2008 11:17 AM

    • Gabriel
    • Top 10 Contributor
      Male
    • Joined on 12-26-2006
    • Florida
    • Posts 162
    • Points 2,055

    Deploying A BAT File

     Hi everyone, listen I'm trying to deploy a bat file using sccm, I have created a package within sccm and in the command line, I know I have to supply some parameters within the command line of the program in order to execute this bat file. You cannot just simply pointed to the directory of where the bat file resides. Can anyone give me some advice on how to accomplish this. Oh one more the reason Im deploying the bat file versus any other vbs or other is because I need the bat file to do a couple of things before calling on other executables. Thanks in advance.

    Gabriel (MCP)
    • Post Points: 20
  • 09-18-2008 12:40 PM In reply to

    Re: Deploying A BAT File

    2 rules of thumb when using a batch file:

    1. Always have the advertisement download it to the local cache.

    2. Use full paths for everything such as c:\windows\system32\.....

    If you run it from a DP, it can be a mess.

    Brian S. Tucker
    The Blogcast Repository - MCSE, MCDBA & MCT
    • Post Points: 20
  • 09-18-2008 1:03 PM In reply to

    • Gabriel
    • Top 10 Contributor
      Male
    • Joined on 12-26-2006
    • Florida
    • Posts 162
    • Points 2,055

    Re: Deploying A BAT File

     Cool no Problem Brian, I dont plan to use the distribution point for this since within the batch file itself it will call on a share on the network from where the install will run from and install.

    What Im not clear on is the syntax used within the command line of the Program /Package, For example I create the package and point the command line option to the bat file where it is located.

    Now if I point the command line options within the program to the bat file , it doesnt do anything, I deploy the advertisement and it htis the computer but fails to run the bat file or execute anything. 

     

    Gabriel (MCP)
    • Post Points: 20
  • 09-18-2008 1:24 PM In reply to

    Re: Deploying A BAT File

    If you post the code here, I can test it tomorrow or over the weekend and get it to work or you can send it to me in a private email. We can get you running.

    Brian S. Tucker
    The Blogcast Repository - MCSE, MCDBA & MCT
    • Post Points: 20
  • 09-18-2008 2:48 PM In reply to

    • Gabriel
    • Top 10 Contributor
      Male
    • Joined on 12-26-2006
    • Florida
    • Posts 162
    • Points 2,055

    Re: Deploying A BAT File

     Brian basically in the command line with the program / package I have set the parameters to    Call "\\xxx\xxxx\xxxx\test.bat"

    If I do this from the command line on a computer, it works, it calls the bat file and executes it. I use this because within dos you cant call on UNC paths, therefore I tested this and it works. It calls the bat file and runs it, it will run anything from the directory that you specify but within sccm , Apparently you cant use this sytax because it expects something else I guess.  I get the advertisement but then I get an error, This program cannot be ran because the files cannot be found. I have not set the program/package  with additional files or anything else. 

    Gabriel (MCP)
    • Post Points: 20
  • 10-08-2008 8:48 AM In reply to

    Re: Deploying A BAT File

    Not sure if you are also using "Call" in command line :). But in fact you have to enter only the "test.bat" in command line and program executes by joining the Package source to the Program command line..

    Here is How it woks.

    For example if  You created package with package source folder \\servername\sharename\TestFolder\ and test.bat file in that location..for package you Should give \\servername\sharename\TestFolder\ and in Program command line only enter Test.bat. and distribute to folder called smspkgp$\Testfolderwhen advertisement calls the Program It collects the path from DP as "\\DPserver\smspkgp$\Testfolder" and command line test.bat.. and executes it..Finally it runs as \\DPserver\smspkgp$\Testfolder\test.bat 
    • Post Points: 20
  • 10-08-2008 1:25 PM In reply to

    • Gabriel
    • Top 10 Contributor
      Male
    • Joined on 12-26-2006
    • Florida
    • Posts 162
    • Points 2,055

    Re: Deploying A BAT File

     Well currently what I have tested with was with this example. Exactly how it is inside the command line option.  ( Call "\\xxx\xxxx\xxxx\test.bat") . 

    I have tried using the what you suggest above but it didnt work its like it doesnt  get executed when it gets to the computer. 

    Perhaps I did something wrong doing this, I will try what you mentioned above and see if it works. Will post back. Thanks in advance.

    Gabriel (MCP)
    • Post Points: 5
Page 1 of 1 (7 items)