Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallTo change the registry of the Windows installation being deployed, add a General → Run Command Line step after Setup Windows and ConfigMgr. A command that runs earlier may change Windows PE instead of the installed operating system.
Why the task-sequence position matters
Configuration Manager task sequences can run commands in Windows PE, the temporary preinstallation environment, or in the full Windows operating system being deployed. A registry command writes to the environment in which it runs. Microsoft describes Setup Windows and ConfigMgr as the transition from Windows PE to the new operating system; after Windows Setup completes, the task sequence resumes in the full OS. See Microsoft’s task-sequence step documentation.
As an Amazon Associate I earn from qualifying purchases.
For a normal OS deployment, place the registry command after that transition. Editing an offline Windows registry hive before the transition is a different approach and is not needed for an ordinary machine-level change.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Add a Run Command Line step
- Open the task sequence in the Configuration Manager console and open the Task Sequence Editor.
- Choose Add → General → Run Command Line.
- Move the new step below Setup Windows and ConfigMgr. It need not be immediately adjacent, but placing it nearby makes the execution phase clear and reduces the chance that a later deployment action will overwrite the value.
- Enter the command in the step’s Command line field. During testing, leave Continue on error disabled so a failed command is not silently treated as a successful deployment.
- Run a test deployment, then verify the value in the installed operating system.
A typical sequence is:
Apply Operating System
Apply Windows Settings
Apply Network Settings
Setup Windows and ConfigMgr
Run Command Line - Add registry values
Install Applications / Configure Windows
The step is appropriate for unattended commands; it must not wait for input or open an interactive tool. Microsoft documents the Run Command Line action and its execution behavior at the task-sequence steps reference.
#1 Best Overall
Build the registry command correctly
For a single value, use cmd.exe /c to run reg add. Quote the key path, especially if it contains spaces, specify the value name and type, and use /f to suppress the overwrite confirmation prompt.
Add a DWORD
cmd.exe /c reg add "HKLMSOFTWAREExampleProduct" /v Enabled /t REG_DWORD /d 1 /f
Add a string
cmd.exe /c reg add "HKLMSOFTWAREExampleProduct" /v SettingName /t REG_SZ /d "ExampleValue" /f
Choose a registry view when needed
On 64-bit Windows, an application may expect a value in a particular registry view. Specify /reg:64 or /reg:32 when that requirement is known rather than assuming the views are interchangeable:
cmd.exe /c reg add "HKLMSOFTWAREExampleProduct" /v Enabled /t REG_DWORD /d 1 /f /reg:64
cmd.exe /c reg add "HKLMSOFTWAREExampleProduct" /v Enabled /t REG_DWORD /d 1 /f /reg:32
Microsoft’s reg add reference documents its syntax, supported types, quoting for key names containing spaces, the two registry-view switches, and return codes: 0 indicates success and 1 indicates failure.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Rank #2
Examples from a Windows deployment question
These commands illustrate writing the values discussed in a historical Configuration Manager deployment thread; they are examples of registry writes, not a guarantee that the associated Windows behavior will be achieved:
cmd.exe /c reg add "HKLMSOFTWAREPoliciesMicrosoftWindowsStore" /v AutoDownload /t REG_DWORD /d 2 /f
cmd.exe /c reg add "HKLMSOFTWAREPoliciesMicrosoftWindowsCloud Content" /v DisableWindowsConsumerFeatures /t REG_DWORD /d 1 /f
The original poster reported that moving the commands to the post-setup portion resolved the registry-write issue. The thread is historical, covering SCCM 2012 and Windows 10; it also reports that the values did not prevent unwanted applications from downloading. Do not treat those commands alone as a current, universal application-control solution. See the original forum discussion.
Verify the write in the installed OS
Add a temporary verification step immediately after the write, or run the query after deployment. For example:
Rank #3
cmd.exe /c reg query "HKLMSOFTWAREPoliciesMicrosoftWindowsStore" /v AutoDownload
For the other example:
cmd.exe /c reg query "HKLMSOFTWAREPoliciesMicrosoftWindowsCloud Content" /v DisableWindowsConsumerFeatures
A successful query displays the value name, type, and data. Also check the Run Command Line step’s status and return code, then inspect smsts.log around that step if the result is unexpected. Confirm you are checking the installed OS, the intended registry view, and—if applicable—the intended user profile.
Choose the right hive: HKLM or HKCU
HKLM is generally the relevant hive for machine-wide settings. HKCU refers to the current execution account’s profile, not automatically to every user who will later sign in. Task-sequence commands commonly run as Local System unless configured otherwise, so an HKCU write may affect the system account rather than the future interactive user.
For a per-user setting, choose an approach that matches when and for whom it must apply: configure the default user profile, apply it at first logon or in user context, use a policy-management mechanism, or load and edit the intended user’s NTUSER.DAT hive offline. The appropriate method depends on the setting and deployment design; a machine-context command is not a substitute for user-profile targeting.
Rank #4
Troubleshoot a value that is missing or does not stick
- The step ran before the OS transition: move it after Setup Windows and ConfigMgr. A successful command in Windows PE does not establish that the installed OS was changed.
- The key path contains spaces: put quotation marks around the complete key path, such as
"HKLMSOFTWAREPoliciesMicrosoftWindowsCloud Content". - The value is in the wrong view: check the view the application uses and specify
/reg:32or/reg:64if required. - The type or data is wrong: match
/tto the expected registry type, such asREG_DWORDorREG_SZ, and confirm the data withreg query. - The task sequence appears to succeed despite a command error: check whether Continue on error is enabled. During troubleshooting, disable it and review the command’s return code;
reg addreturns0for success and1for failure. - The parent key is missing:
reg addcan create a key or value, but it cannot add an entire subtree in one operation. Create required levels separately or import a.regfile. - The value changes after the step: a later task-sequence action, installer, Group Policy, MDM policy, baseline, remediation, or first-logon action may set it again. A successful write is not proof that the value remains the final effective configuration. Microsoft notes that Group Policy normally processes after Windows Setup and the task sequence completes, although some task-sequence actions can trigger policy evaluation earlier.
- The command blocks or restarts deployment unexpectedly: keep commands silent and unattended; use
/frather than relying on confirmation prompts. Do not restart the computer directly from the command. For a command that needs a restart, Microsoft says to return the standard code3010so Configuration Manager can manage the restart and resume the sequence.
When to use a script, a .reg file, or policy instead
Use direct reg add for a small machine-level change
For one or two values, a quoted reg add command in a post-transition Run Command Line step is easy to inspect and verify.
Use a .reg file for a related set of values
Package the file with the deployment content and import it silently:
Recommended Free Tools
cmd.exe /c regedit.exe /s Settings.reg
This keeps a larger group of settings together, but requires care with user hives, architecture, and file availability; an import can also make it less obvious which individual value failed. The original forum thread discusses packaging registry settings for import.
Best Value
Use a CMD or PowerShell script for logic and error handling
A batch file can check the command result and return a failure code to the task sequence:
@echo off
reg add "HKLMSOFTWAREExampleProduct" /v Enabled /t REG_DWORD /d 1 /f
if errorlevel 1 exit /b 1
exit /b 0
For multiple values, conditions, or structured error handling, a packaged script can be easier to maintain than a long command line. A PowerShell equivalent for a DWORD is:
New-Item -Path 'HKLM:SOFTWAREExampleProduct' -Force | Out-Null
New-ItemProperty -Path 'HKLM:SOFTWAREExampleProduct' -Name 'Enabled' -PropertyType DWord -Value 1 -Force | Out-Null
Ensure scripts run silently and unattended in the intended execution context. Microsoft’s task-sequence documentation covers these requirements for command-line and PowerShell actions.
Use policy management when the setting must be enforced
If a registry value represents a Windows policy that must remain enforced, apply it through the appropriate Group Policy, Intune policy, Settings Catalog, policy CSP, or other management mechanism when available. Policy management is better suited to settings that must apply to multiple users, be reapplied after drift, change without reimaging, or vary by device group. A one-time task-sequence registry write does not itself provide ongoing enforcement.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




