Skip to content

Instantly share code, notes, and snippets.

runscript -Raw=```
# 1. Find and remove all MDM enrollments from registry
$enrollPath = 'HKLM:\SOFTWARE\Microsoft\Enrollments'
$statusPath = 'HKLM:\SOFTWARE\Microsoft\Enrollments\Status'
$omadmPath = 'HKLM:\SOFTWARE\Microsoft\Provisioning\OMADM\Accounts'
# Skip the default keys that Windows needs
$skip = @('Context', 'Status', 'ValidNodePaths')
Get-ChildItem $enrollPath -ErrorAction SilentlyContinue | Where-Object {