WSL 2 ships as an optional Windows component on supported Windows 10 and Windows 11 editions. Whether it actually runs on a given endpoint depends on the Windows edition and version, whether the feature and its virtualization prerequisites are enabled, and any organizational restrictions already in place.
Where those conditions are met, WSL can run until an admin restricts it, which makes it a policy problem first and an install problem second. You control it fleet-wide in two places. One is the Intune Settings Catalog, where you search for “Windows Subsystem for Linux” in a Windows 10 and later profile. The other is Microsoft’s WSL ADMX template for classic Group Policy.
This guide walks the WSL 2 Group Policy and Intune controls in fault-tree order. You’ll audit what’s on the endpoints, apply the policy, then verify that it took. It skips installation, general networking fixes, and backups. Those have their own guides on the site.
Quick Reference: WSL 2 Group Policy and Intune Controls
| Goal | Setting to change | Value |
|---|---|---|
| Block WSL entirely | Allow WSL | Disabled |
| Force WSL2 only | Allow WSL1 | Disabled, then convert existing distros with wsl --set-version |
| Force the Store version of WSL | Allow the Inbox version of the Windows Subsystem for Linux | Disabled |
| Stop custom Linux kernels | Allow custom kernel configuration | Disabled |
Restrict .wslconfig network/firewall keys | Allow custom networking configuration, Allow user setting firewall configuration | Disabled |
| Remove debugging surfaces | Allow kernel debugging, Allow the debug shell | Disabled |
| Audit an endpoint | wsl --status, wsl --version, wsl --list --verbose | Run in the user’s context |
What Are the WSL Fleet Controls?
Microsoft documents one policy set for WSL and exposes it two ways (Intune settings for WSL). Three settings decide whether WSL runs and which flavor runs: Allow WSL, Allow the Inbox version, and Allow WSL1. A second group locks the advanced .wslconfig options. Users would otherwise edit those in their home directory.
One detail drives the whole design. The .wslconfig restriction policies apply only to the Store version of WSL. The inbox version is the built-in optional component, and it ignores them. If you want the kernel and networking locks to mean anything, disable the inbox version too.
Do you need Intune? No. The ADMX template gives domain-joined or standalone machines a similar set of controls, based on Microsoft’s current WSL policy documentation, though full parity between the Intune and Group Policy surfaces for every setting isn’t guaranteed release to release.
You lose cloud-based assignment and reporting with Group Policy alone. That trade-off matters once devices stop touching the domain.
Prerequisites
- Managed Windows 10 or Windows 11 endpoints with the Windows Subsystem for Linux and Virtual Machine Platform optional features available
- For Intune: an Intune subscription and an admin account that can create device configuration profiles
- For Group Policy: rights to write to the domain central store (or local admin on a standalone machine) and Microsoft’s WSL ADMX/ADML files
- For Defender visibility: a Microsoft Defender for Endpoint subscription and a WSL/Windows version that meets the plug-in’s current requirements (check Microsoft’s WSL plug-in documentation for specifics)
- A test device or pilot group that isn’t your CEO’s laptop
Licensing note: WSL itself doesn’t require a separate license and is available as part of supported Windows 10 and Windows 11 installations, though exact availability can vary by edition and version. Intune and Defender for Endpoint are separately licensed products, distinct from each other and from Windows. Check your current agreement and the Windows edition on your fleet before you plan around any of them.
Step-by-Step Guide
Step 1: Audit What’s Actually Installed
Don’t write policy against assumptions. Pick a representative endpoint, open PowerShell as the logged-in user, and capture a baseline.
Distributions are typically registered per user rather than at the machine level.
If you run these commands as SYSTEM from a management agent, you may see no distributions listed even when a user has WSL in heavy use, so run the audit in the logged-in user’s context to get an accurate picture.
# Package version of WSL plus kernel and Windows build
wsl --version
# Default distro and default WSL architecture
wsl --status
# Every registered distro, its state, and whether it's WSL1 or WSL2
wsl --list --verbose
Expected output (version numbers vary by device):
WSL version: 2.x.x.x
Kernel version: 6.x.x.x
...
Windows version: 10.0.xxxxx.xxxx
Default Distribution: Ubuntu
Default Version: 2
NAME STATE VERSION
* Ubuntu Stopped 2
Debian Stopped 1
Three signals are worth watching for here. First, which WSL is installed. If wsl --version errors out while wsl --status still works, the device is probably on the inbox component, but don’t classify a device on that alone. Confirm it by checking for the Store package in the user’s context:
# Returns the package (with its Version) when Store WSL is installed; returns nothing on inbox-only devices
Get-AppxPackage -Name MicrosoftCorporationII.WindowsSubsystemForLinux | Select-Object Name, Version
If the package is present and wsl --version prints a WSL version line, treat the device as Store WSL. If the package is absent, the device is likely inbox-only, but package visibility can depend on the user context and how WSL was provisioned, so confirm with wsl --version (and an elevated Get-AppxPackage -AllUsers query) before you act on it.
Second, any 1 in the VERSION column is a WSL1 distro you’ll convert in Step 7. Third, the WSL version line: the Defender plug-in in Step 9 needs WSL 2.0.7.0 or later.
Step 2 (Web): Create an Intune Settings Catalog Profile
- Sign in to the Microsoft Intune admin center.
- Go to Devices > Configuration. Some tenants and docs label it Devices > Manage devices > Configuration. Same destination.
- Select Create > New policy.
- Set Platform to Windows 10 and later and Profile type to Settings catalog. Click Create.
- Name it something you’ll recognize in six months, like
WSL - Hardening Baseline. Click Next. - Click Add settings, then type the following in the settings picker search box:
Windows Subsystem for Linux
- Select the category in the results and tick the settings you plan to manage.
Search by name instead of browsing. The menu labels move around between portal revisions, and searching by setting name is usually the quickest way to find them (Settings catalog docs).
Step 3 (Web): Set the Security Baseline Values
For maximum security, Microsoft says to disable the inbox version and WSL1. Then you turn off whichever .wslconfig toggles your risk tolerance demands. Here’s a sensible baseline for a corporate developer fleet:
| Setting | Baseline value | Why |
|---|---|---|
| Allow WSL | Not configured (or Disabled to block outright) | Master switch. Disabled blocks WSL on the device |
| Allow the Inbox version of the Windows Subsystem for Linux | Disabled | Forces the Store package, where the .wslconfig locks apply |
| Allow WSL1 | Disabled | WSL2-only architecture |
| Allow custom kernel configuration | Disabled | Blocks wsl2.kernel in .wslconfig |
| Allow kernel command line configuration | Disabled | Blocks wsl2.kernelCommandLine |
| Allow custom system distribution configuration | Disabled | Blocks wsl2.systemDistro |
| Allow custom networking configuration | Disabled | Blocks wsl2.networkingmode |
| Allow user setting firewall configuration | Disabled | Blocks wsl2.firewall |
| Allow nested virtualization | Disabled unless devs run VMs inside WSL | Blocks wsl2.nestedVirtualization |
| Allow kernel debugging | Disabled | Blocks kernel debugging configuration |
| Allow the debug shell | Disabled | Blocks wsl.exe --debug-shell |
Treat the mappings above as Microsoft’s documented intent. Verify each one on a pilot device before you rely on it fleet-wide, since exact enforcement can vary by WSL build.
The custom kernel setting answers the most common audit question: “how do I stop users from loading their own Linux kernel?” Disable it, and Store WSL ignores wsl2.kernel in a user’s .wslconfig.
Leave nested virtualization alone if your developers run Docker-in-VM or Kubernetes test clusters inside WSL. Disabling it breaks those workflows. The ticket volume will tell you within a day.
Step 4 (Web): Assign and Create
- Click Next past Scope tags unless you use them.
- Under Assignments, add a pilot Microsoft Entra group first, then widen it later.
- Click Review + create > Create.
The profile applies on each device’s next check-in. To speed things up on a test machine, open Settings > Accounts > Access work or school. Select the account, click Info, and then click Sync.
A completed sync only means the device received the profile. Intune’s per-setting status can lag behind, and a running WSL instance keeps its current configuration until it restarts, so run wsl --shutdown before you test and judge the result by the Step 10 checks, not by the sync message.
Step 5 (Windows): Import the WSL ADMX Template into Group Policy
For fleets without Intune, the ADMX template exposes the WSL policies to Group Policy. Don’t assume it matches the Settings Catalog setting for setting: compare the policies the template actually shows in the editor against the Step 3 table before you build the GPO. Microsoft ships the WSL ADMX/ADML pair separately from the base Windows templates. Get the current link from the Intune settings for WSL page, not a third-party mirror.
Domain central store (run on a machine with access to SYSVOL, and replace contoso.com):
# Copy the template into the domain central store
Copy-Item .\WSL.admx "\\contoso.com\SYSVOL\contoso.com\Policies\PolicyDefinitions\"
# ADML language file goes in the matching locale subfolder
Copy-Item .\en-US\WSL.adml "\\contoso.com\SYSVOL\contoso.com\Policies\PolicyDefinitions\en-US\"
Standalone machine (elevated PowerShell):
Copy-Item .\WSL.admx "C:\Windows\PolicyDefinitions\"
Copy-Item .\en-US\WSL.adml "C:\Windows\PolicyDefinitions\en-US\"
Use whatever filenames the downloaded package actually contains. The ADMX and ADML base names must match. If they don’t, the editor shows a “resource not found” error when it loads the category.
Open Group Policy Management (gpmc.msc) and edit a new GPO, or open gpedit.msc locally. Expand Computer Configuration > Administrative Templates and find the new WSL category.
Step 6 (Windows): Configure, Link, and Refresh the GPO
Set the same values as the Step 3 table. Friendly names in the ADMX can differ slightly from Intune’s wording. When in doubt, match on the explain text. Link the GPO to the OU holding your target computers, then refresh policy on a test device:
gpupdate /force
Expected output:
Updating policy...
Computer Policy update has completed successfully.
User Policy update has completed successfully.
Confirm the GPO actually applied before you blame WSL for anything:
# /r prints a summary of applied GPOs; /scope computer limits it to machine policy
gpresult /r /scope computer
Your WSL GPO should appear under Applied Group Policy Objects. If it shows under The following GPOs were not applied, look at scope or security filtering. WSL isn’t involved.
Step 7: Convert Existing WSL1 Distributions
Disabling Allow WSL1 stops WSL1 distributions from launching under that policy. Existing WSL1 distributions aren’t converted for you; they stay WSL1 and won’t start until someone converts them.
A user with an older WSL1 distro can end up with something that won’t launch, and the help desk hears about it. The cleaner order is to convert WSL1 distros on the pilot devices before the policy reaches them, then test the conversion again on a device that already has the policy. Convert each distro explicitly:
# Replace Debian with the NAME shown in wsl --list --verbose
wsl --set-version Debian 2
This is the command syntax shown in current Microsoft guidance, but confirm it with wsl --help on your installed version, since command options can change between WSL releases.
Conversion rewrites the distro’s filesystem into a virtual disk. It can take several minutes on large distros, so get a backup first.
Warning: Back up the distribution before converting. An interrupted conversion can leave it unusable.
Export first, and keep the tar until the user confirms the converted distro works:
# Back up before converting
wsl --export Debian D:\wsl-backup\debian.tar
# Rollback if conversion fails: create the install folder first, then remove the broken registration and re-import as WSL2
New-Item -ItemType Directory -Force -Path C:\WSL\Debian
wsl --unregister Debian
wsl --import Debian C:\WSL\Debian D:\wsl-backup\debian.tar --version 2
wsl --unregister deletes the distro’s data, so run it only after you’ve confirmed the export file is complete and the destination folder exists. Run these lines in PowerShell, since New-Item is a PowerShell cmdlet. A re-imported distro logs in as root by default until you set the default user again in /etc/wsl.conf.
Verify the conversion:
wsl --list --verbose
NAME STATE VERSION
* Ubuntu Stopped 2
Debian Stopped 2
Every row should read 2.
Step 8: Lock Down What WSL Can Reach on the Network
Two policies restrict specific .wslconfig keys: Allow custom networking configuration blocks the networkingMode key, and Allow user setting firewall configuration blocks the firewall key. Disabling them stops a user from switching WSL’s network mode or firewall integration locally.
These two policies control configuration, not traffic. They don’t select a network mode for you, create any firewall rules, or by themselves guarantee that all WSL traffic is governed by a single, consistent Windows Firewall assumption.
With both disabled, WSL should follow whichever networking mode you’ve set for the fleet rather than a value the user picks. Treat that as a configuration-lockdown guarantee, not a network-enforcement one.
Confirm the actual behavior on a pilot device for your WSL version and chosen networking mode (NAT, mirrored, or bridged), since behavior differs by mode and can change between builds.
Both policies apply only to Store WSL. That’s the second reason Step 3 disables the inbox version.
You still have to design, deploy, and test the actual allow/block rules yourself in Windows Defender Firewall with Advanced Security (wf.msc), or through Intune’s endpoint security firewall policies. Do this as a separate project from the policy lockdown above, validated against whichever networking mode you’ve standardized on.
A typical pattern is an outbound block on sensitive internal subnets, with a narrow allow for package mirrors. The screenshot below shows a host Windows Defender Firewall rule; that’s a host-traffic example, not a guaranteed control over WSL traffic. Don’t copy it straight to the fleet.
Which rules actually see WSL traffic depends on the networking mode and Windows build (on recent Windows 11 builds, the separate Hyper-V firewall settings for WSL also apply), block rules win over allow rules, and DNS, proxy and VPN dependencies can break developer workflows in ways a quick test misses. Pilot the rules with real developer workloads first.
Our WSL networking troubleshooting guide covers how the networking modes differ. The policy job here is narrower: it keeps users from changing the mode or the firewall flag, not from reaching the network at all without rules you’ve written and tested.
Step 9: Meet the Defender for Endpoint Plug-in Requirements
The Defender for Endpoint WSL plug-in is designed to give your security team visibility into distributions running under WSL, according to Microsoft’s documentation. It’s a compliance layer on top of your WSL policy, and you still need that policy regardless of whether you turn the plug-in on.
Microsoft’s plug-in documentation lists these prerequisites:
- WSL version 2.0.7.0 or later, with at least one active distro (WSL containers need 2.9.12 or later)
- The Windows device onboarded to Defender for Endpoint
- Windows 10 version 2004 and later (build 19044 and later), or Windows 11
- An x64 device: the plug-in isn’t supported on ARM64 processors or on multi-session editions of Windows 10 and 11
Expect a delay: a WSL2 instance can take up to 30 minutes to appear in the Defender portal. The plug-in also doesn’t guarantee visibility when a custom kernel and custom kernel command line are in use, and Microsoft recommends blocking those with the Intune WSL settings, which is what the Step 3 baseline does. These thresholds can change, so recheck the page before a large rollout.
Check and update on the endpoint:
wsl --version
wsl --update
For compliance checks in Intune, follow Microsoft’s current guidance in Configure WSL compliance in Intune, since the recommended deployment method can change over time.
Step 10: Verify the Policy End to End
On a pilot device, reboot, sign in as a standard user, and test both the allowed and the blocked paths:
wsl --status
wsl --list --verbose
Then test the custom kernel lock. Before you change anything, record the stock kernel with wsl uname -r; it should match the Kernel version line from wsl --version. Add kernel=C:\\temp\\custom-kernel under [wsl2] in %UserProfile%\.wslconfig, run wsl --shutdown, and start the distro again. Run wsl uname -r once more.
With the policy in effect, the distro starts and wsl uname -r still reports the stock kernel version. A missing kernel file can produce a similar fallback or a startup error even without the policy, so for a conclusive test, repeat it on an unmanaged control device (or before the policy applies) and compare the results. Remove the test line afterward.
Configuration Patterns
| Fleet type | Allow WSL | Inbox version | WSL1 | .wslconfig toggles |
|---|---|---|---|---|
| No Linux needed (finance, front desk) | Disabled | n/a | n/a | n/a |
| Developer laptops | Not configured | Disabled | Disabled | Kernel, cmdline, system distro, networking, firewall, debug off. Nested virt on if needed |
| Regulated workloads | Not configured | Disabled | Disabled | All toggles Disabled, plus the Defender plug-in |
| Small homelab fleet, no Intune | Not configured | Disabled | Disabled | Same values via local or domain ADMX |
The inbox version is the Windows optional component. The Store version is a separately updated package, and it’s the one the .wslconfig restriction policies apply to. If you disable the inbox version, the Store package has to reach those devices some other way if users can’t use the Microsoft Store: deploy it as a managed app through Intune, or package the WSL release installer for your existing software-distribution tool. Otherwise users end up with no WSL at all.
Tips and Troubleshooting
WSL fails with 0x800704ec, “This program is blocked by group policy”
Why it happens: An Intune or Group Policy setting is blocking WSL on that device. A stale WSL version can also cause it.
Fix: Start with the low-blast-radius check and run wsl --update. If the error persists, it’s policy. As an admin, run gpresult /r on GPO-managed devices, or check the device’s configuration profile status in Intune. Look for Allow WSL set to Disabled. Also look for Allow the Inbox version disabled on a device that only has the inbox component. End users can’t fix this themselves, so they need to contact their administrator (WSL FAQ).
WSL1 distros still show up after disabling Allow WSL1
Why it happens: The policy blocks WSL1 from running. It doesn’t rewrite existing distros.
Fix: Run wsl --set-version <DistroName> 2 per distro and confirm with wsl --list --verbose.
Users can’t install or update WSL at all
Why it happens: The inbox version is disabled, but the Store package can’t reach the device. Or Allow WSL is disabled outright.
Fix: Check both settings in the effective policy. Then confirm the Microsoft Store or your app-deployment pipeline is available to those devices.
.wslconfig restrictions don’t seem to apply
Why it happens: The device is running inbox WSL, which ignores these policies.
Fix: Run wsl --version. If it errors or reports the inbox component, disable the inbox version and move the device to the Store package.
The Defender plug-in isn’t evaluating distributions
Why it happens: WSL is below the plug-in’s minimum version, no distro is active, the distro runs as WSL1, or the host build is too old.
Fix: Run wsl --update, start a distro, confirm VERSION is 2, and check the Windows build against the plug-in’s current documented requirements.
Can’t find the WSL settings in Intune
Why it happens: Portal menu labels shift between revisions.
Fix: In a Windows 10 and later Settings Catalog profile, search “Windows Subsystem for Linux” in the picker.
Wrapping Up
You can now block WSL outright, pin a fleet to WSL2 on the Store package, and stop users from changing the kernel, kernel command line and networking keys in .wslconfig. That’s configuration control over the settings these policies cover, not a guarantee against every change: local admins, host-level networking and anything outside those policies still need their own controls.
The trade-off is user friction. Lock nested virtualization or the debug shell on a dev team that relies on them, and you’ll field tickets. The Store-only rule catches more admins than anything else, because the .wslconfig locks do nothing on inbox WSL.
| Step | Action | Applies To |
|---|---|---|
| 1 | Audit with wsl --version, --status, --list --verbose | Windows |
| 2-4 | Settings Catalog profile, baseline values, assignment | Web (Intune) |
| 5-6 | Import ADMX, configure GPO, gpupdate /force | Windows (Group Policy) |
| 7 | Convert WSL1 distros with wsl --set-version | Windows |
| 8 | Lock .wslconfig networking/firewall keys, then write and test firewall rules separately | Both |
| 9 | Meet Defender plug-in version minimums | Both |
| 10 | Reboot and re-test as a standard user | Windows |
The check that counts comes after a reboot and a policy refresh. gpresult /r (or Intune’s profile status) should still list the WSL policy, and wsl --list --verbose should still show only 2.