fleet/it-and-security/lib/windows/scripts
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
..
create-admin-user.ps1 Uninstall fleetd remotely (#27024) 2025-03-19 13:35:39 -05:00
default-exe-install-script.ps1 Fix exe installer script (#31071) 2025-07-18 23:14:29 -05:00
enable-ms-defender.ps1 Reorganize our it-and-security directory (#24278) 2024-12-09 13:42:47 -06:00
install-bitdefender.ps1 Reorganize our it-and-security directory (#24278) 2024-12-09 13:42:47 -06:00
turn-off-mdm.ps1 Update turn-off-mdm.ps1 (#38384) 2026-01-16 10:31:05 -06:00
uninstall-fleetd-windows.ps1 Fix path escaping to properly handle script path with white spaces (#36065) 2025-11-20 11:52:38 -06:00
uninstall-slack.ps1 Updating Windows installers (#31076) 2025-07-20 00:30:12 -05:00
uninstall-zoom.ps1 Update uninstall-zoom.ps1 (#31072) 2025-07-19 00:05:04 -05:00