October, 2020
Stopping mandatory SCCM Reboot last minute
Open an elevated powershell window and run the commands:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
#Clears Restart registry to stop SCCM restarting the machine Remove-Item -Path 'HKLM:\SOFTWARE\Microsoft\SMS\Mobile Client\Reboot Management\RebootData' Remove-Item -Path 'HKLM:\SOFTWARE\Microsoft\SMS\Mobile Client\Updates Management\Handler\UpdatesRebootStatus\*' Remove-ItemProperty -Name * -Path 'HKLM:\Microsoft\Windows\currentVersion\windowsupdate\Auto Update\RebootRequired' shutdown -a #Disable as it starts ccmexec back up Disable-ScheduledTask -TaskPath "Microsoft\Configuration Manager" -TaskName "Configuration Manager Passport for Work Certificate Enrollment Task" #Re-enable next boot $Action = New-ScheduledTaskAction -Execute "schtasks.exe" -Argument '/Change /TN "Microsoft\Configuration Manager\Configuration Manager Passport for Work Certificate Enrollment Task" /enable' $Trigger = New-ScheduledTaskTrigger -AtStartup; $Trigger.EndBoundary = (get-date).AddDays(90).ToString('s') $Settings = New-ScheduledTaskSettingsSet -DeleteExpiredTaskAfter 00:00:30 Register-ScheduledTask -Force -user SYSTEM -TaskName "Enable CM Passport Enrollment" -Action $Action -Trigger $Trigger -Settings $Settings Stop-Service ccmexec -Force |
To use it in a run script and get feedback we need to delay the restart of the service using scheduled task
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
Remove-Item -Path 'HKLM:\SOFTWARE\Microsoft\SMS\Mobile Client\Reboot Management\RebootData' Remove-Item -Path 'HKLM:\SOFTWARE\Microsoft\SMS\Mobile Client\Updates Management\Handler\UpdatesRebootStatus\*' Remove-ItemProperty -Name * -Path 'HKLM:\Microsoft\Windows\currentVersion\windowsupdate\Auto Update\RebootRequired' shutdown -a #Disable as it starts ccmexec back up Disable-ScheduledTask -TaskPath "Microsoft\Configuration Manager" -TaskName "Configuration Manager Passport for Work Certificate Enrollment Task" #Re-enable next boot $Action = New-ScheduledTaskAction -Execute "schtasks.exe" -Argument '/Change /TN "Microsoft\Configuration Manager\Configuration Manager Passport for Work Certificate Enrollment Task" /enable' $Trigger = New-ScheduledTaskTrigger -AtStartup; $Trigger.EndBoundary = (get-date).AddDays(90).ToString('s') $Settings = New-ScheduledTaskSettingsSet -DeleteExpiredTaskAfter 00:00:30 Register-ScheduledTask -Force -user SYSTEM -TaskName "Enable CM Passport Enrollment" -Action $Action -Trigger $Trigger -Settings $Settings $Action = New-ScheduledTaskAction -Execute "powershell.exe" -Argument '-command Stop-Service ccmexec -Force' $Trigger = New-ScheduledTaskTrigger -Once -At (get-date).AddSeconds(10); $Trigger.EndBoundary = (get-date).AddSeconds(60).ToString('s') $Settings = New-ScheduledTaskSettingsSet -StartWhenAvailable -DeleteExpiredTaskAfter 00:00:30 Register-ScheduledTask -Force -user SYSTEM -TaskName "Stop ccmexec" -Action $Action -Trigger $Trigger -Settings $Settings Write-Host 'Restart cancelled. CCMEXEC Service will stop in 10 seconds' |
Thanks @PotentEngineer and Russ for the code I mismashed together
Office 2019 Fails to activate - Windows Virtual Desktop
Office will fail to activate because Microsoft sets the KMS server in the registry which overrides any method of finding the on-prem kms.
You can deploy a reg to remove these settings. I don't know how that's going to play with the multi-user version but might be ok...
1 2 3 4 5 6 |
Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform] "KeyManagementServiceName"=- "KeyManagementServiceListeningPort"=- |
Revisiting how SCCM imports and names images
When capturing the image using build and capture, you have the option of setting a description.
This description used to be part of the image name when importing, at some point that changed and no longer worked.
This image description was set for the wim, where as when importing the image description SCCM was looking for to set the name in SCCM based on the image index.
A workaround to this was to use imagex to set the description on the image index
In my scenario the import would look like
Then something changed
Images now import using the Image Index name, and description replacing spaces with dashes (Still never using the one in the capture step).
At this point I was confused to what happened so I turned off my Set Image Description.
This was the result (default I guess):
It's now using Image Index Number-Image-Index Description.wim with dashes replacing spaces.
So you can set the image index description by imagex (I don't think there's an equivalent dism command) and deal with the extra junk, that's the best you can do as far as I know without looking at a powershell import cmdlet equivalent (New-CMOperatingSystemImage).
My Current Build capture and outcome: