App Layering: Office MCS Rearm failure because kmssetup.cmd is running multiple times

App Layering: Office MCS Rearm failure because kmssetup.cmd is running multiple times

book

Article ID: CTX229151

calendar_today

Updated On:

Description

Created a new layer following https://support.citrix.com/article/CTX224566. After publishing the image and using Studio to upgrade catalog using MCS, we receive the following error:

Task Information: Start Date: Friday, October 6, 2017 Start Time: 1:46 PM Finish Date: Friday, October 6, 2017 Finish Time: 1:50 PM State: Failed Master image: XDHyp:\HostingUnits\XenApp Cluster\W2K12-LAB-2017-10-06_13-30-21.992.vm\Layered Image Deployed.snapshot Terminating Error: Image Preparation Office Rearm Failed Stack Trace: at Citrix.Console.PowerShellSdk.ProvisioningSchemeService.BackgroundTasks.ProvisioningSchemeTask.CheckForTerminatingError(SdkProvisioningSchemeAction sdkProvisioningSchemeAction) at Citrix.Console.PowerShellSdk.ProvisioningSchemeService.BackgroundTasks.ProvisioningSchemeTask.WaitForProvisioningSchemeActionCompletion(Guid taskId, Action`1 actionResultsObtained) at Citrix.Console.PowerShellSdk.ProvisioningSchemeService.BackgroundTasks.PublishProvisioningSchemeImageTask.RunTask() at Citrix.Console.PowerShellSdk.BackgroundTaskService.BackgroundTask.Task.Run() DesktopStudio_ErrorId : ProvisioningTaskError ErrorCategory : NotSpecified ErrorID : ImagePreparationOfficeRearmFailed TaskErrorInformation : Terminated InternalErrorMessage : Office Licensing Rearm failed

Looking in C:\Windows\Setup\Scripts\kmsdir\kmssetup.log, you can see that the App Layering startup script called kmssetup.cmd is being run multiple times in parallel:
 
Mon 10/16/2017-19:07:53.25-kmssetup.cmd:OSLayerEdit Not Found in Registry 
Mon 10/16/2017-19:07:53.25-kmssetup.cmd:OSLayerEdit Not Found in Registry 
Mon 10/16/2017-19:07:53.25-kmssetup.cmd:OSLayerEdit Not Found in Registry 
Mon 10/16/2017-19:07:53.25-kmssetup.cmd:OSLayerEdit Not Found in Registry 
Mon 10/16/2017-19:07:53.25-kmssetup.cmd:OSLayerEdit Not Found in Registry 
Mon 10/16/2017-19:07:53.28-kmssetup.cmd:BootVolumeIsAnImage [0x1] Found in Registry 
Mon 10/16/2017-19:07:53.28-kmssetup.cmd:BootVolumeIsAnImage [0x1] Found in Registry 
Mon 10/16/2017-19:07:53.28-kmssetup.cmd:BootVolumeIsAnImage [0x1] Found in Registry 
Mon 10/16/2017-19:07:53.28-kmssetup.cmd:BootVolumeIsAnImage [0x1] Found in Registry 
Mon 10/16/2017-19:07:53.31-kmssetup.cmd:BootVolumeIsAnImage [0x1] Found in Registry 
Mon 10/16/2017-19:07:53.37-kmssetup.cmd:Adding old process complete flag files because this is a fresh install
Mon 10/16/2017-19:07:53.37-kmssetup.cmd:Adding old process complete flag files because this is a fresh install
Mon 10/16/2017-19:07:53.39-kmssetup.cmd:------------Configure Powershell-----------
Mon 10/16/2017-19:07:53.39-kmssetup.cmd:------------Configure Powershell-----------
Mon 10/16/2017-19:07:53.39-kmssetup.cmd:capture powershell execution policy to ps.txt
Mon 10/16/2017-19:07:53.39-kmssetup.cmd:set powershell execution-policy to remotesigned
Mon 10/16/2017-19:07:53.39-kmssetup.cmd:------------Configure Powershell-----------
Mon 10/16/2017-19:07:53.39-kmssetup.cmd:capture powershell execution policy to ps.txt
Mon 10/16/2017-19:07:53.39-kmssetup.cmd:set powershell execution-policy to remotesigned
Mon 10/16/2017-19:07:53.39-kmssetup.cmd:------------Configure Powershell-----------
Mon 10/16/2017-19:07:53.39-kmssetup.cmd:capture powershell execution policy to ps.txt
Mon 10/16/2017-19:07:53.41-kmssetup.cmd:set powershell execution-policy to remotesigned
Mon 10/16/2017-19:07:53.41-kmssetup.cmd:------------Configure Powershell-----------
Mon 10/16/2017-19:07:53.41-kmssetup.cmd:capture powershell execution policy to ps.txt
Mon 10/16/2017-19:07:53.41-kmssetup.cmd:set powershell execution-policy to remotesigned
Mon 10/16/2017-19:07:54.25-kmssetup.cmd:create kms cleanup flag file to trigger cleanup processing
Mon 10/16/2017-19:07:54.25-kmssetup.cmd:create kms cleanup flag file to trigger cleanup processing

Resolution

KMSSETUP.CMD (and thus OfficeActivate.cmd) must run only once at startup.  If somehow it is running multiple times, Office and Windows activation may suffer.  One common way to get this is to specify kmssetup.cmd as a domain GPO startup script in addition to it already being a local policy startup script.  Do not do that; allow it to run only asa local policy startup script.

it was also observed once that it was specified multiple times as a local policy startup script.  We do not know how it got to be this way, but we found multiple subfolders under this registry key, each of which was specifying kmssetup.cmd:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\Scripts\Startup\0

If you see this, version your OS layer (and any other layer you think might be contributing) and delete any keys other than HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\Scripts\Startup\0\0 that might be specifying kmssetup.cmd.  Then try again.