Closes #38916 Related: #34993, #33985, fleetdm/confidential#13228 ## Changes **Article update** (`articles/windows-mdm-setup.md`) - Adds "Migrating from another MDM solution" subsection under **Manual enrollment** with overview of common migration issues and links to remediation scripts **New scripts** (`docs/solutions/windows/scripts/`) - `reset-mdm-enrollment-flag.ps1` — Resets MmpcEnrollmentFlag blocking MDM status after migration - `remove-stale-mdm-enrollment-records.ps1` — Clears orphaned enrollment GUIDs, AAD discovery cache, and MS DM Server cache - `fix-workplace-join-configuration.ps1` — Re-enables Automatic-Device-Join task and configures Workplace Join policies - `remove-unreachable-wsus-configuration.ps1` — Removes unreachable WSUS server config that breaks Windows Update ## Context Customers migrating Windows hosts from Intune to Fleet have been hitting recurring enrollment issues, MDM status stuck on "Off," enrollment errors (`0x80190190`, `0x8018000a`), and Windows Update breakage from leftover RMM agents. These scripts consolidate the workarounds from multiple customer engagements into self-serve remediation that can be deployed via **Controls > Scripts**. --------- Co-authored-by: Marko Lisica <83164494+marko-lisica@users.noreply.github.com>
15 KiB
Windows MDM setup
To control OS settings, updates, and more on Windows hosts follow the manual enrollment instructions.
To use automatic enrollment (aka zero-touch) features on Windows, follow instructions to connect Fleet to Microsoft Entra ID. You can further customize zero-touch with Windows Autopilot.
To migrate Windows hosts from your current MDM solution to Fleet, follow the Automatic Windows MDM migration instructions.
Turn on Windows MDM
Step 1: Generate your certificate and key
Fleet uses a certificate and key pair to authenticate and manage interactions between the Fleet server and a Windows host.
How to generate a certificate and key:
-
With OpenSSL installed, open your Terminal (macOS) or PowerShell (Windows) and run the following command to create a key:
openssl genrsa --traditional -out fleet-mdm-win-wstep.key 4096. -
Create a certificate:
openssl req -x509 -new -nodes -key fleet-mdm-win-wstep.key -sha256 -days 3652 -out fleet-mdm-win-wstep.crt -subj '/CN=Fleet Root CA/C=US/O=Fleet.'.
Note: The default
opensslbinary installed on macOS is actuallyLibreSSL, which doesn't support the--traditionalflag. To successfully generate these files, make sure you're usingOpenSSLand notLibreSSL. You can check what youropensslcommand points to by runningopenssl version.
Step 2: Configure Fleet with your certificate and key
In your Fleet server configuration, set the contents of the certificate and key in the following environment variables:
Note: Any environment variable that ends in
_BYTESexpects the file's actual content to be passed in, not a path to the file. If you want to pass in a file path, remove the_BYTESsuffix from the environment variable.
Restart the Fleet server.
Step 3: Turn on Windows MDM
-
Head to the Settings > Integrations > Mobile device management (MDM) page.
-
Next to Turn on Windows MDM select Turn on to navigate to the Manage Windows MDM page.
-
Select Turn on.
Manual enrollment
With Windows MDM turned on, enroll a Windows host to Fleet by installing Fleet's agent (fleetd).
Windows tamper protection is disabled on a host when MDM is turned on.
Migrating from another MDM solution
When migrating Windows hosts from another MDM, devices may fail to report MDM as "On." You might see enrollment errors (e.g., 400 or 0x8018000a) in fleetd logs.
These issues are caused by residual enrollment data, registry conflicts, or third-party management agents from the previous MDM solution. Run the scripts below on the affected hosts, then reboot the device and select Refetch on the host details.
-
reset-mdm-enrollment-flag.ps1: Resets the
MmpcEnrollmentFlagregistry value to fix incorrect MDM status reporting after migration. -
remove-stale-mdm-enrollment-records.ps1: Removes failed or orphaned MDM enrollment records, AAD discovery cache, and MS DM Server cache left behind by the previous MDM solution.
-
fix-workplace-join-configuration.ps1: Re-enables the Automatic-Device-Join scheduled task and fixes Workplace Join policies that may be misconfigured after migration.
-
remove-unreachable-wsus-configuration.ps1: Removes stale WSUS server configurations that can break Windows Update after migration. Only removes the configuration if the WSUS server is unreachable.
Conflicting RMM or management agents: Third-party RMM agents (such as N-able/SolarWinds, ConnectWise, or Kaseya) installed alongside the previous MDM solution can interfere with Fleet's MDM enrollment and may cause Windows Update to stop functioning. Check for and remove any RMM agents that are no longer needed before or after migrating to Fleet.
Automatic enrollment
Available in Fleet Premium
To automatically enroll Windows workstations when they’re first unboxed and set up by your end users, we will connect Fleet to Microsoft Entra ID.
Connecting Fleet to Entra also enables end users to manually turn on MDM via the Settings > Access work or school workflow. Fleet will collect the email and store it as the IdP username. If a different email is used during the setup experience, it won't override the one used in Settings > Access work or school.
After you connect Fleet to Entra, you can customize the Windows setup experience with Windows Autopilot.
In order to connect Fleet to Entra, the IT admin (you) needs a Microsoft Enterprise Mobility + Security E3 license. Each end user who automatically enrolls or manually turns on MDM needs at least a Microsoft Entra P1 license. If they already have an E3 or E5 license then you're good to go.
Step 1: Buy Microsoft licenses
-
Sign in to Microsoft 365 admin center.
-
In the left-side bar select Marketplace.
-
On the Marketplace page, select All products and in the search bar below All products enter "Enterprise Mobility + Security E3".
-
Find Enterprise Mobility + Security E3 and select Details
-
On the Enterprise Mobility + Security E3 page, select Buy and follow instructions to purchase the license.
-
Find and buy a license.
-
Sign in to Microsoft Entra ID portal.
-
At the top of the page search "Users" and select Users.
-
Select or create a test user and select Licenses.
-
Select + Assignments and assign yourself the Enterprise Mobility + Security E3. Assign the test user the Intune licnese.
Step 2: Connect Fleet to Microsoft Entra ID
The end user will see Microsoft's default initial setup. You can further simplify the initial device setup with Autopilot, which is similar to Apple's Automated Device Enrollment (DEP).
Some Intune/Entra deployments enable automatic enrollment into Intune. Check to ensure Automatic Enrollment is not enabled, or your devices will not appear in Fleet.
In your Intune settings, select Devices, and under Device onbarding, open the Enrollment submenu. Select Automatic Enrollment and ensure both MDM user scope and Windows Information Protection (WIP) user scope are set to None.
- Sign in to Azure portal.
- At the top of the page, search "Domain names" and select Domain names. Select + Add custom domain, type your Fleet URL (e.g. fleet.acme.com), and select Add domain.
- Use the information presented in Azure AD to create a new TXT/MX record with your domain registrar, then select Verify. If you're a managed-cloud customer, please reach out to Fleet to create a TXT/MX record for you.
- At the top of the page, search for "Mobility" and select Mobility (MDM and WIP).
- Select + Add application, then select + Create your own application.
- Enter "Fleet" as the name of your application and select Create.
- Set MDM user scope to All, then in the Fleet UI head to Settings > Integrations > MDM > Windows Enrollment and copy the URLs on the Microsoft Entra page (
/settings/integrations/automatic-enrollment/windows). Paste them in Azure AD, and select Save. - While on this same page, select the Custom MDM application settings link.
- Click on the Application ID URI which will bring you to the Expose an API submenu with an edit button next to the text box.
- Replace with your Fleet URL (e.g. fleet.acme.com) and select Save.
- Select API permissions from the sidebar, then select + Add a permission.
- Select Microsoft Graph, then select Delegated permissions, and select Group > Group.Read.All and Group > Group.ReadWrite.All and Add permissions.
- Again select + Add a permission and then Microsoft Graph and Application permissions, select the following:
- Device > Device.Read.All
- Device > Device.ReadWrite.All
- Directory > Directory.Read.All
- Group > Group.Read.All
- User > User.Read.All
- Select Add permissions.
- Select Grant admin consent for [your tenant name], and confirm.
Now you're ready to automatically enroll Windows hosts to Fleet.
Step 3: Test automatic enrollment
Testing automatic enrollment requires creating a test user in Microsoft Entra ID and a freshly wiped or new Windows workstation.
-
Sign in to Microsoft Entra ID portal.
-
At the top of the page search "Users" and select Users.
-
Select + New user > Create new user, fill out the details for your test user, and select Review + Create > Create.
-
Go back to Users and refresh the page to confirm that your test user was created.
-
Open your Windows workstation and follow the setup steps. When you reach the How would you like to set up? screen, select Set up for an organization. If your workstations has Windows 11, select Set up for work or school.
-
Sign in with your test user's credentials and finish the setup steps.
-
When you reach the desktop on your Windows workstation, confirm that your workstation was automatically enrolled to Fleet by selecting the carrot (^) in your taskbar and then selecting the Fleet icon. This will navigate you to this workstation's My device page.
-
On the My device page, below My device confirm that your workstation has a Status of "Online."
Windows Autopilot
Step 1: Create an Autopilot profile
-
Sign in to Microsoft Intune using the Intune admin user from step 1.
-
In the left-side bar select Devices > Enroll devices. Under Windows Autopilot Deployment Program select Deployment Profiles to navigate to the Windows Autopilot deployment profiles page.
-
Select + Create profile > Windows PC and follow steps to create an Autopilot profile. On the Assignments step, select + Add all devices.
Step 2: Register a test workstation
-
Open your test workstation and follow these Microsoft instructions to export your workstations's device hash as a CSV. The CSV should look something like
DeviceHash_DESKTOP-2V08FUI.csv -
In Intune, in the left-side bar, select Devices > Enroll devices. Under Windows Autopilot Deployment Program select Devices to navigate to the Windows Autopilot devices page.
-
Select Import and import your CSV.
-
After Intune finishes the import, refresh the Windows Autopilot devices page several times to confirm that your workstation is registered with Autopilot.
Step 3: Upload your organization's logo
-
Navigate to Microsoft Entra ID portal.
-
At the top of the page, search for "Microsoft Entra ID", select Microsoft Entra ID, and then select Company branding.
-
On the Company Branding page, select Configure or Edit under Default sign-in experience.
-
Select the Sign-in form tab and upload your logo to the Square logo (light theme) and Square logo (dark theme) fields.
-
In the bottom bar, select Review + Save and then Save.
Step 4: Test Autopilot
-
Wipe your test workstation.
-
After it's been wiped, open your workstation and follow the setup steps. At screen in which you're asked to sign in, you should see the title "Welcome to [your organziation]!" next to the logo you uploaded in step 4.
Automatic Windows MDM migration
Fleet can automatically migrate your Windows hosts from another MDM solution to Fleet without end user interaction.
Step 1: Set up Windows MDM in Fleet
Follow the steps above to turn on Windows MDM in Fleet.
Step 2: Install Fleet's agent on the hosts
-
Enroll the Windows hosts you want to migrate to Fleet.
-
Navigate to the Hosts tab in the main navigation bar and wait until your hosts are visible in the hosts list.
Step 3: Enable automatic migration
-
Head back to the Settings > Integrations > Mobile device management (MDM) page.
-
Next to Windows MDM turned on (servers excluded) select Edit to navigate to the Manage Windows MDM page.
-
On the Manage Windows MDM page, select Automatically migrate hosts connected to another MDM solution. Click Save to save the change.
Step 4: Monitor your hosts as they migrate to Fleet MDM
Once the automatic migration is enabled, Fleet sends a notification to each host to tell it to migrate. This process usually takes a few minutes at most.
You can track migration progress in Fleet.
Turn off Windows MDM
- Turn off MDM for each host, by running this script on all your Windows hosts.
- Head to Settings > Integrations > MDM.
- In the Mobile device management (MDM) section, select Edit next to "Windows MDM turned on."
- Switch Windows MDM on to Windows MDM off and select Save.
