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 SCCM task sequence must be installed silently when you decide to add during the OS deployment.

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

  • Command line added to this step shouldn’t interact with the desktop. The command 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 Run Command Line in Task sequence and learn about the available options –

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

Patch My PC

Create or Edit an Existing Task Sequence

This Guide will help you to 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 then select the Task Sequences node.
  • In the Task Sequence list, select the task sequence that you want to edit. Select Edit to modify.
Add Run Command Line Step to SCCM Task Sequence
Add Run Command Line Step to SCCM Task Sequence
  • To add this step in the task sequence editor, select Add, select General, and select Run Command Line.
SCCM Task Sequence - Add > General > Run Command Line
Add Run Command Line Step to SCCM Task Sequence

Properties for Run Command Line

  • On the Properties tab for Run Command Line step, You can configure the following settings –
    • 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)

Note – Assign the proper Name, Description for step. This helps you to track and troubleshoot in case of any failure.

1E Nomad
Add Run Command Line Step to SCCM Task Sequence
Add Run Command Line Step to SCCM Task Sequence

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 executable folder for the program, up to 127 characters. This folder can be an absolute path on the destination computer or a path relative to the distribution point folder that contains 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. If the specified files exist on the destination computer, this option isn’t required.

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

SCCM Task Sequence - Add Run Command Line Step
Add Run Command Line Step to SCCM Task Sequence

Time-out (minutes)

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

Run this step as the following account (Account)

Here you can specify the local user or domain account to run the command line. 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.

Add Run Command Line Step to SCCM Task Sequence
Add Run Command Line Step to SCCM Task Sequence

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 Deployment solution with Configuration Manager, Microsoft Deployment Toolkit (MDT), and Microsoft Intune.

Resources

Leave a Comment

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