How to Add Run Command Line Step to SCCM Task Sequence

Let’s learn how to add Run Command Line Step to SCCM Task Sequence. The command line added to the SCCM task sequence must be installed silently when you add it during the OS deployment.

This option helps the SCCM Admin perform various operations easily during the operating system deployment with the Task sequence. The following details will provide insights into the available options with this step. As per Microsoft posts, the run command must meet the following criteria.

  • The command line added to this step should not interact with the desktop. It must run silently or in an unattended mode.
  • It must not initiate a restart on its own. The command must request a restart using the standard restart code, 3010. This behavior makes sure that the task sequence properly handles the restart. If the command does return a 3010 exit code, the task sequence engine restarts the computer. After the restart, the task sequence automatically continues.

How to Add Run Command Line Step to SCCM Task Sequence

Let’s follow the below steps to add the Run Command Line in the Task sequence and learn about the available options –

Note – You can run this step in the full OS or Windows PE.

Patch My PC
[sibwp_form id=2]

Create or Edit an Existing Task Sequence

This guide will help you create a Configuration Manager task sequence from scratch. Use the following steps to modify an existing task sequence –

  • In the Configuration Manager console, go to the Software Library workspace, expand Operating Systems, and select the Task Sequences node.
  • Select the task sequence you want to edit in the Task Sequence list. Select Edit to modify.
How to Add Run Command Line Step to SCCM Task Sequence - Fig.1
How to Add Run Command Line Step to SCCM Task Sequence – Fig.1
  • To add this step in the task sequence editor, select Add, General, and Run Command Line.
How to Add Run Command Line Step to SCCM Task Sequence - Fig.2
How to Add Run Command Line Step to SCCM Task Sequence – Fig.2

Properties for Run Command Line

On the Properties tab for the Run Command Line step, You can configure the following settings –

Properties for Run Command Line
Command line
Output to task sequence variable
Disable 64-bit file system redirection
Start in
Package
Time-out (minutes)
Run this step as the following account (Account)
How to Add Run Command Line Step to SCCM Task Sequence – Table 1

Note: Assign the proper Name and description for each step. This helps you track and troubleshoot in case of failure.

Adaptiva
How to Add Run Command Line Step to SCCM Task Sequence - Fig.3
How to Add Run Command Line Step to SCCM Task Sequence – Fig.3

Command line

Here, you can specify the command line that the task sequence runs with filename extensions or directly paste the line in the proper format, which you can execute using the command-line options.

Output to task sequence variable

You can use this setting to save the command output to a custom task sequence variable.

Disable 64-bit file system redirection

By default, 64-bit operating systems use the WOW64 file system redirector to run command lines. This behavior is to find 32-bit versions of OS executables and libraries properly. Select this option to disable the use of the WOW64 file system redirector. Windows runs the command using native 64-bit versions of OS executables and libraries. This option has no effect when running on a 32-bit OS.

Start in

This field is optional. You can specify the program’s executable folder, up to 127 characters. This folder can be an absolute path on the destination computer or relative to the distribution point folder containing the package.

Package

When you specify files or programs on the command line that aren’t already present on the destination computer, select this option to specify the Configuration Manager package that contains the necessary files. The package doesn’t require a program. This option isn’t required if the specified files exist on the destination computer.

In this example, the package referenced has files referenced to the command line (DefaultApps.bat).

How to Add Run Command Line Step to SCCM Task Sequence - Fig.4
How to Add Run Command Line Step to SCCM Task Sequence – Fig.4

Time-out (minutes)

This option is disabled by default. Specifies a value representing how long Configuration Manager allows the command line to run. The value can be from one minute to 999 minutes. The default value is 15 minutes.

Run this step as the following account (Account)

You can specify the local user or domain account to run the command line here. The command line runs with the permissions of the specified account. Select Set to specify the account.

Options for Run Command Line

On the  Run Command Line step, Options tab. Here, you can configure the additional settings of this task sequence step –

Continue on error – When you select Continue on error on the Options tab of this step, the task sequence continues when a command line fails to execute. When you don’t enable this option, the task sequence fails and will not execute the remaining steps.

Success codes – Include other exit codes from the script that the step should evaluate as success.

Resources

We are on WhatsApp. To get the latest step-by-step guides and news updates, Join our Channel. Click here –HTMD WhatsApp.

Author

Jitesh KumarMicrosoft MVP, has over six years of working experience in the IT Industry. He writes about and shares his experiences related to Microsoft device management technologies and IT infrastructure management. His primary focus is Windows 10/11 Deployment solution with Configuration Manager, Microsoft Deployment Toolkit (MDT), and Microsoft Intune.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.