Let’s learn how you can quickly copy files to client machines using SCCM aka, Configuration Manager. This would be helpful for SCCM admins to copy the content locally for execution based on business requirements. I had noticed some times files need to be copied inside the machine to perform several actions.
Due to limitations or the execution of some script files from the network shared location is being treated as an unsafe or malicious script during SCCM Task Sequence in case scripts are not digitally signed with a trusted digital certificate.
However, It’s not recommended to run any suspicious scripts in your production environment. In some scenarios the copy content or the script locally and executing it that might help us to avoid encountered issues.
- Display Message in SCCM Task Sequence Unsupported Hardware Model
- SCCM Customize Windows Out of Box Experience OOBE Using ConfigMgr
- Easy Guide to Deploy Wallpaper using SCCM
Prepare Copy Files to Client Machines Scripts
This is a simple task, and I am trying to demonstrate to you all understand how you can copy the content locally to client machines based on your requirements.
- Create a folder in your shared source.
- Copy all the content inside the shared folder which needs to be copied to client machines.
- Prepare a command line for execution which will be responsible for copying the content from SCCM Content Souce to Client Machines.
For Example: Here, you can see the placed CopyFiles.bat will perform the needed action to copy the content to C:\Windows\Temp directory. You can modify the command line, Source, and Destination based on business needs.
Create Package for Copy Files to Client Machines using SCCM
Let’s follow the step by step process to create a package for copy files to client machines using SCCM –
In the Configuration Manager console, Go to the Software Library workspace, expand Application Management, Right-click Packages, and select Create Package.
On the Package page, Specify the following information and click Next.
- Name: Specify a name for the package.
- Description: Specify a description for this package.
- Source folder: Choose to Browse to select the Network Share (UNC) path and then specify the location of the source files for the package.
Note – Ensure you have copied the file to the network path. You must have access to the network path and any subfolders content.
On the Program Type, Choose the type of program Standard program. Click Next.
Note – Here you can also choose the option “Do not create a program” and complete the process and later on add the package, command line by choosing Run Command Line options from the task sequence step. More you can check How to Add Run Command Line Step to SCCM Task Sequence
On the Standard Program page, specify the following information and click Next.
- Name: Specify a name for the program
- Command Line: Enter the command line to use to start this program, or choose Browse to browse to the file location.
- Allow users to view and interact with the program installation: Use this setting, if available, to specify whether to allow users to interact with the program installation. This option is only available if the following conditions are met:
- Program can run setting is Only when a user is logged on or Whether or not a user is logged on
- Run mode setting is to Run with administrative rights
On the Requirements page of the Create Package and Program Wizard, You can specify the following information or leave it to default and click Next.
Review the settings, click Next. The Package creation process completed successfully. Click Close to complete the wizard.
The package now appears in the Packages node of the Configuration Manager console. You’ve finished creating a Package to copy the content.
You must distribute the content to the distribution point. Right-click on package and click Distribute Content, and complete the distribution wizard.
Deploy Package to Client Machines
Based on requirements, you can deploy packages to client machines directly with an SCCM Task Sequence or Via Software Center.
To add the package to the Task Sequence step, Edit your existing task sequence. In the task sequence editor, select Add, select Software, and select Install Package. This action adds the step after the currently selected step. You can move up or down based on requirements.
Using Software Center
- In the Configuration Manager console, go to the Software Library workspace, expand Application Management, and select the Packages node.
- Select the package that you want to deploy and choose Deploy and follow the process to complete deployement.
Results
Here, In the Scenario, we deployed individual packages to client machines. In the target device, launch the Software Center. In the Applications tab Software Center shows the Package is available. Click on the Install button to start the installation.
Note – You can set up the Notification logo for Software Center from SCCM 2111 version onwards.
After successful installation, Software Center shows Scripts Copy Locally package successfully Installed on the target devices.
On client computers, You can see the files are successfully copied to the destination folder. Based on your requirements you can change the path of the folder inside scripts to perform your actions.
To monitor the Package installation on the client computer verify the Execmgr.log file records details about packages and task sequences that run, logs located in the C:\Windows\CCM\Logs folder. You will be able to see the entries like this –
Executing program "CopyFiles.bat" in Admin context execmgr 10-12-2021 12:20:13 11848 (0x2E48)
Execution Request for advert package MEM0004E program Copy Automation Scripts state change from Ready to NotifyExecution execmgr 10-12-2021 12:20:13 11848 (0x2E48)
Raising client SDK event for class CCM_Program, instance CCM_Program.PackageID="MEM0004E",ProgramID="Copy Automation Scripts", actionType 1l, value , user NULL, session 4294967295l, level 0l, verbosity 30l execmgr 10-12-2021 12:20:13 11848 (0x2E48)
Checking content location C:\windows\ccmcache\3d for use execmgr 10-12-2021 12:20:14 11848 (0x2E48)
Successfully selected content location C:\windows\ccmcache\3d execmgr 10-12-2021 12:20:14 11848 (0x2E48)
Executing program as a script execmgr 10-12-2021 12:20:14 11848 (0x2E48)
Successfully prepared command line "C:\windows\ccmcache\3d\CopyFiles.bat" execmgr 10-12-2021 12:20:14 11848 (0x2E48)
Command line = "C:\windows\ccmcache\3d\CopyFiles.bat", Working Directory = C:\windows\ccmcache\3d\ execmgr 10-12-2021 12:20:14 11848 (0x2E48)
Running "C:\windows\ccmcache\3d\CopyFiles.bat" with 32bitLauncher execmgr 10-12-2021 12:20:14 11848 (0x2E48)
Created Process for the passed command line execmgr 10-12-2021 12:20:14 11848 (0x2E48)
Raising event:
[SMS_CodePage(437), SMS_LocaleID(1033)]
instance of SoftDistProgramStartedEvent
{
AdvertisementId = "MEM2001D";
ClientID = "GUID:94A6E2A7-D263-45A5-933D-5C60EBAB5DC2";
CommandLine = "\"C:\\windows\\ccmcache\\3d\\CopyFiles.bat\"";
DateTime = "20211210122014.489000+000";
MachineName = "Prod-Win20";
PackageName = "MEM0004E";
ProcessID = 1552;
ProgramName = "Copy Automation Scripts";
SiteCode = "MEM";
ThreadID = 11848;
UserContext = "NT AUTHORITY\\SYSTEM";
WorkingDirectory = "C:\\windows\\ccmcache\\3d\\";
};
execmgr 10-12-2021 12:20:14 11848 (0x2E48)
Successfully submitted event to the Status Agent. execmgr 10-12-2021 12:20:14 11848 (0x2E48)
Raised Program Started Event for Ad:MEM2001D, Package:MEM0004E, Program: Copy Automation Scripts execmgr 10-12-2021 12:20:14 11848 (0x2E48)
Raising client SDK event for class CCM_Program, instance CCM_Program.PackageID="MEM0004E",ProgramID="Copy Automation Scripts", actionType 1l, value NULL, user NULL, session 4294967295l, level 0l, verbosity 30l execmgr 10-12-2021 12:20:14 11848 (0x2E48)
Program exit code 0 execmgr 10-12-2021 12:20:14 5140 (0x1414)
Looking for MIF file to get program status execmgr 10-12-2021 12:20:14 5140 (0x1414)
Script for Package:MEM0004E, Program: Copy Automation Scripts succeeded with exit code 0 execmgr 10-12-2021 12:20:14 5140 (0x1414)
Raising event:
[SMS_CodePage(437), SMS_LocaleID(1033)]
instance of SoftDistProgramCompletedSuccessfullyEvent
{
AdvertisementId = "MEM2001D";
ClientID = "GUID:94A6E2A7-D263-45A5-933D-5C60EBAB5DC2";
DateTime = "20211210122014.731000+000";
MachineName = "Prod-Win20";
PackageName = "MEM0004E";
ProcessID = 1552;
ProgramName = "Copy Automation Scripts";
SiteCode = "MEM";
ThreadID = 5140;
UserContext = "NT AUTHORITY\\SYSTEM";
};
execmgr 10-12-2021 12:20:14 5140 (0x1414)
Successfully submitted event to the Status Agent. execmgr 10-12-2021 12:20:14 5140 (0x1414)
Raised Program Success Event for Ad:MEM2001D, Package:MEM0004E, Program: Copy Automation Scripts execmgr 10-12-2021 12:20:14 5140 (0x1414)
Execution is complete for program Copy Automation Scripts. The exit code is 0, the execution status is Success execmgr 10-12-2021 12:20:14 5140 (0x1414)
Author
About Author -> Jitesh has over 5 years of working experience in the IT Industry. He writes and shares his experiences related to Microsoft device management technologies and IT Infrastructure management. His primary focus area is Windows 10, Windows 11 Deployment solution with Configuration Manager, Microsoft Deployment Toolkit (MDT), and Microsoft Intune.