PrepareOS
1.10.1
standalone (ConfigMgr Capture Media or ad-hoc) or as a ConfigMgr/MECM Task
Sequence step, writes a CMTrace-compatible log, and drives the Task Sequence
progress dialog when one is present.
Optional parts (each controlled by a -Skip* switch):
GPT - GPT attribute check / remediation
standalone (ConfigMgr Capture Media or ad-hoc) or as a ConfigMgr/MECM Task
Sequence step, writes a CMTrace-compatible log, and drives the Task Sequence
progress dialog when one is present.
Optional parts (each controlled by a -Skip* switch):
GPT - GPT attribute check / remediation
BitLocker - Decrypt and verify all BitLocker volumes
SCCM - Remove the SCCM/ConfigMgr client
Appx - Remove non-provisioned Appx packages
DISM - ScanHealth / RestoreHealth / ComponentCleanup
Sysprep - Generalize and shut down via Sysprep
When running inside a Task Sequence the script calls
Microsoft.SMS.TSProgressUI.ShowActionProgress to reflect live progress.
AUTOMATIC SKIPS (v1.10.1)
-------------------------
The script resolves the effective -Skip* state before building the plan and
logs every automatic decision. Two independent mechanisms apply:
1) Task Sequence auto-skip
When Microsoft.SMS.TSEnvironment is detected and the switch was NOT passed
on the command line, the following are forced to $true:
-SkipSCCM ConfigMgr client removal belongs in a dedicated TS step;
removing the agent mid-TS kills the TS execution engine.
-SkipSysprep Sysprep belongs in a dedicated TS step (or the Capture
step) after this script has finished.
-SkipRDP Enhanced Session / RDP check is meaningless in Session 0.
Any of these can still be forced ON inside a TS with the explicit
colon syntax, e.g. -SkipSCCM:$false
2) Platform capability guard
-SkipBitLocker is forced to $true when the BitLocker feature/cmdlets are
not present (default state on Windows Server - the previous behaviour
raised a CommandNotFoundException).
-SkipAppx is forced to $true on Windows Server (ProductType 2/3) and on
any SKU where the Appx cmdlets are unavailable (e.g. Server Core), since
Server SKUs are not supposed to carry Store packages.
Installation Options
Owners
Copyright
(c) 2026 Wilhelm J. Kocher. All rights reserved.
Package Details
Author(s)
- Wilhelm J. Kocher
Tags
Windows Sysprep Capture ConfigMgr MECM SCCM TaskSequence OSD BitLocker DISM Appx CMTrace Logging
Functions
Show-Examples Initialize-Log Stop-Log Get-CMTraceTimestamp Write-Log Initialize-TSProgressSupport Set-StepProgress Close-TSProgressDialogSafe Get-LaunchContext Test-IsWindowsTerminalSession Get-SessionType Confirm-NotEnhancedSessionForSysprep Write-InlineProgress Wait-ProcessCompletion Write-DismOutput Get-OSPlatformInfo Test-BitLockerSupported Test-AppxSupported Resolve-EffectiveSwitches Get-ExecutionPlan Format-ActionLabel Enter-Part Invoke-DismWithProgress
PSEditions
Dependencies
This script has no dependencies.
Release Notes
v1.10.1 - CRITICAL Appx fix: provisioned packages were mis-detected and removed.
Provisioned packages are now matched by PackageFamilyName, with a
fail-safe when the provisioning store is unreadable.
v1.10.0 - Task Sequence auto-skip for SCCM client removal, Sysprep and the RDP
gate; platform capability guards for BitLocker and Appx on Server SKUs.
FileList
- PrepareOS.nuspec
- PrepareOS.ps1
Version History
| Version | Downloads | Last updated |
|---|---|---|
| 1.10.1 (current version) | 3 | 9/14/2026 |