Deploying Drive Mappings via Intune Without GPO
Map network drives through Intune using a PowerShell script — no Group Policy required. Works with Entra-joined devices.
If you're moving to Entra ID (Azure AD) joined devices, one of the first things you lose is GPO-based drive mappings. Intune doesn't have a native "map a drive" profile, so you need a PowerShell script.
Here's a clean, production-ready approach.
The script
# Deploy-DriveMappings.ps1
# Maps network drives for Intune-managed devices
# Run as: User context (not SYSTEM)
$driveMappings = @(
@{
Letter = "S:"
Path = "\\fileserver\shared"
Label = "Shared"
}
@{
Letter = "H:"
Path = "\\fileserver\home\$env:USERNAME"
Label = "Home"
}
)
foreach ($drive in $driveMappings) {
$letter = $drive.Letter.TrimEnd(':')
# Remove existing mapping if present
if (Test-Path "$($drive.Letter)\") {
Remove-PSDrive -Name $letter -Force -ErrorAction SilentlyContinue
net use $drive.Letter /delete /y 2>$null
}
try {
New-PSDrive -Name $letter `
-PSProvider FileSystem `
-Root $drive.Path `
-Persist `
-Scope Global `
-ErrorAction Stop
if ($drive.Label) {
$shell = New-Object -ComObject Shell.Application
$shell.NameSpace("$($drive.Letter)\").Self.Name = $drive.Label
}
Write-Output "Mapped $($drive.Letter) -> $($drive.Path)"
}
catch {
Write-Error "Failed to map $($drive.Letter): $_"
exit 1
}
}Deploying via Intune
- Go to Devices > Scripts and remediations > Platform scripts
- Click Add > Windows 10 and later
- Upload the
.ps1file - Set Run this script using the logged on credentials to Yes
- Set Run script in 64 bit PowerShell Host to Yes
- Assign to your device group
Key details
| Setting | Value | Why | |---|---|---| | Run as | User context | Drive mappings need the user's token for network auth | | 64-bit host | Yes | Avoids WoW64 path issues | | Enforce script signature check | No (or sign the script) | Up to your org's policy |
Troubleshooting
Drives don't appear after login: Intune scripts run after the desktop loads. There's a delay — usually 5-15 minutes on first run. After that, the -Persist flag keeps them across reboots.
Access denied errors: The user account must have permissions to the UNC path. This script runs as the user, not SYSTEM, so it uses their credentials.
Script runs but drives vanish: Check if another policy or script is removing them. The Remove-PSDrive cleanup at the top handles stale mappings, but conflicts with other drive-mapping tools (like a lingering GPO) can cause issues.
When to use this vs. other approaches
- FSLogix is better if you need profile containers and drive mappings together
- SharePoint / OneDrive is better if you're moving file shares to the cloud
- This script is the right call when you have on-prem file servers and Entra-joined devices with line-of-sight to the server (VPN or on-network)
Found this useful?
Get new guides and tools in your inbox when they ship. No spam.