What to do if computer is stuck on running setupcomplete.cmd after Windows upgrade?

By | August 19, 2018

I recently had an issue with a Windows 10 upgrade task sequence which was hanging after the last boot. In foreground I could see my poorly designed installation step which was obviously not completing. In background, the cmd that had started it was running: C:\WINDOWS\SMSTSPostUpgrade\setupcomplete.cmd. The process obviously kicks in after a restart at the end of the task sequence. Unfortunately, F8 doesn’t work at that point and I didn’t find any other way to terminate the process that was preventing the computer from booting up.

This may be a rare case, but if you are running in the same situation you can try the two options below:

Option 1: Try to access the machine via the administrative share (\\computername\c$). Navigate to C:\WINDOWS\SMSTSPostUpgrade and either remove the folder completely (it only contains the batch files SetupComplete.cmd and SetupRollback.cmd) or enter an exit at the beginning of SetupComplete.cmd. Remove the folder C:\_SMSTaskSequence to clean the system. Boot again, it should work now.

Option 2: If you can’t access the system remotely or if you want to analyze the cause of the issue, you can try the repair option from USB. To do so, prepare a bootable USB stick with the Windows installation sources on it. You may also use the Recovery Drive wizard on any other Windows 10 installation.
Power the machine on and press the appropriate key to get to the boot options (the key differs per vendor and age of the machine).
Boot into the stick. With a regular Windows 10 image, you select the language and then get to the Install Now page that displays a little Repair-your-computer-link in the lower left corner. Click on it.

 

 

 

 

 

 

 

 

 

With a stick created by the Recovery wizard, select Advanced options. Click on Command Prompt.

 

 

 

 

 

 

 

 

If the disk is BitLocker encrypted, you have to enter the decryption key at this point. Next, delete the folder C:\WINDOWS\SMSTSPostUpgrade and C:\_SMSTaskSequence and boot the machine. Unless you know the cause of the issue already it’s now time to analyze logs (in particular the smsts.log).

Finally, there’s one more thing to check: While the task sequence is running, the SCCM agent is running in provisioning mode which means that the functionality is reduced and ccmexec.exe is terminated. The following registry keys indicate that provisioning mode is active:

HKEY_LOCAL_MACHINE\Software\Microsoft\CCM\CcmExec
SystemTaskExcludes REG_SZ SchedulerStartup;SchedulerShutdown;SchedulerLogon;SchedulerLogoff;ClientRegistrationStartup
ProvisioningMode REG_SZ true
HKEY_LOCAL_MACHINE\Software\Microsoft\SMS\Mobile Client\Software Distribution\State
Paused REG_DWORD 0x1
PausedCookie REG_DWORD 0x225

To get it back to normal mode, just run the command
WMIC /namespace:\\root\ccm path sms_client CALL SetClientProvisioningMode “False” /NOINTERACTIVE

 

 

 

Links:

About the Upgrade command line:

https://www.petervanderwoude.nl/post/how-the-settings-in-configmgr-translate-to-the-command-line-of-the-windows-10-upgrade

About provisioning mode:
https://garytown.com/configmgr-client-provisioning-mode
https://support.microsoft.com/en-us/help/4021950/configuration-manager-client-left-in-provisioning-mode-after-upgrade-t

Leave a Reply

Your email address will not be published. Required fields are marked *