fleet/it-and-security/lib/windows
Allen Houchins e0e7e9bea6
Update turn-off-mdm.ps1 (#38384)
<!-- Add the related story/sub-task/bug number, like Resolves #123, or
remove if NA -->
**Related issue:** Resolves #38252

This pull request improves the Windows MDM unregistration PowerShell
script by adding extra checks and cleanup steps to ensure devices are
properly unenrolled and that the state is clearly reported. The script
now checks for relevant registry values before and after unregistration,
and explicitly clears any remaining values to guarantee correct
detection by Fleet.

Enhancements to device unregistration and registry cleanup:

* Added a pre-check for `DiscoveryServiceFullURL` registry values before
attempting to unregister the device, to provide clearer output about the
device's enrollment state.
* After calling the `UnregisterDeviceWithManagement` API, the script now
explicitly removes any remaining `DiscoveryServiceFullURL` values from
enrollment keys that have a `UPN`, ensuring Fleet properly detects the
device as unenrolled.
* Improved output messages to clearly indicate the actions taken and the
resulting device state, including whether registry values were found,
cleared, or already absent.
* Added error handling to exit with a non-zero code if an error occurs
during unregistration.
2026-01-16 10:31:05 -06:00
..
configuration-profiles Added new Windows Defender policy & configuration profile (#32956) 2025-09-23 14:02:44 -05:00
policies Added new Windows Defender policy & configuration profile (#32956) 2025-09-23 14:02:44 -05:00
queries Multiple updates to queries (#25891) 2025-01-30 13:00:43 -06:00
scripts Update turn-off-mdm.ps1 (#38384) 2026-01-16 10:31:05 -06:00
software Switch to using Slack FMA for macOS and Windows in dogfood (#36757) 2025-12-05 10:24:41 -06:00