Streamline Your SCCM Deployment: Copy & Run Files Efficiently

In this blog post, we will guide you through the steps of “SCCM copy a file in a package then run it.” We’ll keep things simple, so even if you’re new to SCCM, you’ll be able to follow along.

To begin with, here’s a quick step-by-step guide to copy a file in a package then run it using SCCM:

  • Create a new package: This will serve as a container for the files and programs you’ll add.
  • Add the file to the package: This is the file you want to copy and run.
  • Add a program to execute a script or batch file: This program will contain the commands to copy the file. You can use xcopy or robocopy for this.
  • Create another program to run the copied file: This program will execute the copied file after it’s been copied.
  • Deploy the package: This will make the package available to the specified collection of devices.
  • Ensure the ‘Run’ program follows the ‘Copy’ program: This is crucial to ensure that the file is copied before it’s executed.  

However, it’s important to note that this is just an overview of the steps. As you continue reading this blog, you’ll find more methods with their detailed step-by-step instructions on how to copy a file in a package then run it using SCCM.

Therefore, we encourage you to read further for a comprehensive understanding of the process.

How does SCCM reduce errors and improve efficiency in managing network files and software?

When you are using many computers and moving files and software around the network it can be a very challenging.

Specifically, when it is necessary to update, for example, some software, share scripts, as well as copying the configuration files, the process is typically lengthy and prone to errors.

Instead of this, the traditional methods need some form of human interactivity. As a result, the chances of making mistakes are high and it is quite slow.

To illustrate this point, let’s consider a situation where you are in charge of modifying a key configuration file that is necessary on the hundreds of computers.

In this case, it would have been rather very inconvenient and also involved a lot of mistakes were an attempt to conduct the procedure manually to be made.

And that’s where SCCM comes in offering a packaged and automated solution for the same.  

Also Check: How to install the SCCM 2403 Hotfix KB28290310 update ?

How to copy a file in package/client machine then it using SCCM ?  

Copying a file to a client machine using SCCM (System Center Configuration Manager) can be done through several methods. Below are detailed steps for a few common approaches:

Using a Package and Program

Create a New Package:

  • Firstly, open the SCCM console.
  • Secondly, navigate to Software Library > Application Management > Packages.
  • Then, right-click on Packages and select Create Package.
  • Finally, fill in the required details (Name, Description, etc.) and specify the source folder where your file is located.

Add a Program:

  • After creating the package, right-click on it and select Create Program.
  • Next, choose Standard Program and click Next.
  • Then, fill in the program details (Name, Command line, etc.). Use a command like xcopy or robocopy to copy the file. For example: xcopy.exe “source_path\file.txt” “destination_path\” /Y
  • Lastly, set the Run option to Whether or not a user is logged on.

Distribute the Package:

  • First, right-click on the package and select Distribute Content.
  • Then, follow the wizard to distribute the package to the desired distribution points.

Deploy the Package:

  • To begin, right-click on the package and select Deploy.
  • Next, choose the target collection (the group of devices you want to deploy to).
  • Finally, set the deployment settings and schedule as needed.

Monitor the Deployment:

  • Subsequently, use the Monitoring section in the SCCM console to track the deployment status.

Using a Task Sequence

Create a New Task Sequence:

  • Firstly, navigate to Software Library > Operating Systems > Task Sequences.
  • Secondly, right-click and select Create Task Sequence.
  • Then, choose Create a new custom task sequence and fill in the details.

Add a Step to Copy the File:

  • First, in the task sequence editor, click on Add > General > Run Command Line.
  • Next, in the command line field, use xcopy or robocopy to copy the file: xcopy.exe “source_path\file.txt” “destination_path\” /Y

Deploy the Task Sequence:

  • To begin, right-click on the task sequence and select Deploy.
  • Then, choose the target collection and set the deployment options.

Monitor the Task Sequence:

  • Afterwards, check the Monitoring section to see the status of the task sequence execution.

Also Check: How to disable Microsoft Entra Authentication in SCCM for Tenant ?

Using SCCM Applications

Create a New Application:

  • First, navigate to Software Library > Application Management > Applications.
  • Next, right-click and select Create Application.
  • Then, choose the appropriate application type (e.g., Script Installer).

Specify the Content:

  • Subsequently, in the wizard, specify the source folder containing the file you want to copy.

Add Deployment Type:

  • Next, create a new deployment type and specify the command line to copy the file using xcopy or robocopy.

Deploy the Application:

  • First, right-click on the application and select Deploy.
  • Then, choose the target collection and set the deployment options.

Monitor the Application Deployment:

  • Finally, use the Monitoring section to track the deployment status.

Using a PowerShell Script

Create a new package in SCCM:

  • To begin, go to Software Library > Application Management > Packages.
  • Next, right-click and select “Create Package”.
  • Then, fill in the package details, such as name, version, and manufacturer.
  • Lastly, select “This package contains source files” and specify the source directory.

Create a PowerShell script to copy and run the file:

  • Firstly, create a new text file and add the following commands:
  • Secondly, copy-Item -Path “source_file_path” -Destination “destination_file_path” -Force & “destination_file_path\file_name.exe”
  • Finally, save the file with a .ps1 extension (e.g., copy_and_run.ps1).

Add the PowerShell script to the package:

  • First, go to the package properties and select the “Data Source” tab.
  • Then, click “Add” and select the PowerShell script.

Create a program to run the PowerShell script:

  • To begin, go to the package properties and select the “Programs” tab.
  • Next, click “New” and fill in the program details, such as name and command line.
  • Finally, specify the command line as powershell.exe -ExecutionPolicy Bypass -File copy_and_run.ps1.

    Deploy the package to the desired collection:

  • Firstly, go to Software Library > Application Management > Deployments.
  • Secondly, right-click and select “Deploy”.
  • Lastly, select the package and the desired collection.

Also Check: How to download SCCM Configuration Manager ?

How do I troubleshoot issues with file distribution in SCCM ?

Troubleshooting file distribution issues in SCCM (System Center Configuration Manager) can involve several steps. Here’s a guide to help you identify and resolve common problems:

Check Distribution Point Status

Verify Distribution Point Health:

  • First, in the SCCM console, go to Administration > Distribution Points.
  • Then, right-click on the distribution point and select Check Status to see if it’s healthy.

Review Distribution Point Logs:

  • Next, check the distmgr.log file located on the site server (usually found in C:\Program Files\Microsoft Configuration Manager\Logs). This log provides information about the distribution process.

Review Content Status

Content Status:

  • Subsequently, navigate to Monitoring > Distribution Status > Content Status in the SCCM console.
  • Afterwards, check the status of the content you are trying to distribute. Look for any errors or warnings.

Content Distribution Logs:

  • Additionally, review the contenttransfermanager.log and pkgxfermgr.log files on the distribution point for any issues related to content transfer.

Check Client Logs

Client Log Files:

  • Moving on to the client machine, check the following logs for errors:
  • DataTransferService.log: Firstly, this log provides information about the content download process.
  • execmgr.log: Secondly, this log shows the execution of programs and can indicate if the program failed to run after distribution.

Validate Package and Program Settings

Package Configuration:

  • Next, ensure that the package is correctly configured. Check the source folder path and ensure the files are present.

Program Command Line:

  • Furthermore, verify the command line in the program settings. Ensure it points to the correct executable or script.

Check Network Connectivity

Network Issues:

  • Moreover, ensure that there are no network issues preventing the client from accessing the distribution point. Check firewall settings and network configurations.

Test Connectivity:

  • Additionally, use tools like ping or telnet to test connectivity to the distribution point from the client machine.

Review Security Permissions

Permissions:

  • Also, ensure that the client has the necessary permissions to access the distribution point and the content. Check NTFS permissions on the source folder and distribution point.

Re-distribute Content

Re-distribute the Package:

  • If you suspect the package is corrupted or not properly distributed, then right-click on the package and select Redistribute.

Check for Updates and Patches

SCCM Updates:

  • Furthermore, ensure that your SCCM environment is up to date with the latest updates and patches, as these can resolve known issues.

Use SCCM Tools

SCCM Client Health:

  • In addition, use the Client Health tool to ensure that the SCCM client is functioning correctly on the client machine.

SCCM Console:

  • Likewise, use the SCCM console to monitor and manage deployments, and check for any alerts or notifications related to distribution issues.

Consult Documentation and Community

Microsoft Documentation:

  • Finally, refer to Microsoft’s official documentation for troubleshooting guidance specific to your version of SCCM.

Community Forums:

  • Lastly, engage with community forums and user groups for additional insights and solutions from other SCCM users.

Also Check: How to create Automatic Deployment Rule in SCCM ?

Conclusion

In conclusion, mastering the art of copy a file in a package then run it using SCCM can dramatically streamline your IT management processes.

Throughout this guide, we’ve explored a variety of methods to accomplish this task, from using packages and programs to leveraging task sequences and PowerShell scripts.

Moreover, each approach offers unique benefits, allowing you to choose the one that best fits your organization’s needs.

However, it is important to remember that while SCCM provides powerful tools to automate file distribution and execution, it’s critical to thoroughly test your deployments in a controlled environment before deploying them to your network.

In case you experience any problem, you don’t need to panic – here are solutions to some of the most common problems you are likely to face.

When using these techniques, the chances of making mistakes will be minimized, time wasted in handling the network files and software will be greatly reduced.

Source : [ community.spiceworks, anoopcnair, prajwaldesai, reddit ]

Frequently Asked Question’s (FAQ’s)

How to copy a file via SCCM ?

Create a new package and add the file.
Create a program to execute a script or batch file that copies the file to the desired location.
Deploy the package to the target collection.

How do you copy an application in SCCM ?

Create a new package and add the application’s installation files.
Create a program within the package, specifying the command line to launch the installation.
Deploy the package to the desired collection.

How do I copy a collection in SCCM ?

Navigate to the Assets and Compliance workspace and select Device Collections or User Collections. Right-click on the collection you want to copy and choose Copy. Then, right-click on the target location and select Paste, where you can rename the new collection and adjust its settings as needed.


Content Writer

Smith Ron, the writer at Assistme360. He has extensive experience in crafting straightforward, step-by-step guides for technical issues. His broad knowledge ensures accurate solutions. Kindly spare a moment to drop a comment down and express your opinions. Your feedback can be valuable in assisting others who may come across similar problems.


Leave a Comment