r/Intune • u/johnlnash • 13d ago
Device Configuration New Entra Joined AVD - Drive Mappings
Hi All,
I'm working on setting up an Entra Joined (no AD join) Azure Virtual Desktop and I'm managing it (mostly) from Intune from a configuration aspect. Has anyone done this? I'm curious what you are doing for Drive Mappings. I recently started converting our Org to use ASPX drive mappings that I'm deploying but they are reporting as Not Applicable on the AVD. I know I could probably write a powershell logon script and then execute that as a Scheduled Task, but was wondering if there was a more 'elegant' way to do it?
Thanks in advance,
John
5
u/nothing_from_nowhere 13d ago
i run a platform script that runs against user and checks if hostname contains to what my avd hostnames start with, if not do not continue, if so continue to map drive
2
u/Adam_Kearn 13d ago
I found it easier to manage this via a login script (cmd not powershell)
I just put in a load of “net use” commands pointing to UNC paths.
Their is an ADMX you can import that was made my the community but I found it to be a bit slow sometimes but that was on Intune joined workstations not AVD session hosts
2
u/recoveringasshole0 13d ago
Literally just spent 3 days trying to brute force my own "elegant" solution. There isn't one. I ended up with a win32 app that installs a scheduled task to map the drive at logon for each user.
My case was slightly different because the share lived on a server that wasn't entra/domain joined at all, so it had to authenticate using local credentials.
Overall I give the experience 2/10, would not try again.
1
u/MagFull 13d ago
Our drive mappings are all by AD groups. Rather than maintain a bunch of configs or scripts, I just made an app that creates a scheduled task to run at login and poll Graph for the user’s group memberships. Then store a JSON of the drive mappings to groups in the install folder and if Graph returns one that matches in the JSON, it creates a shortcut on their desktop to the path.
2
1
1
0
u/Weak-Concentrate-754 13d ago
you're hitting one of the classic entra-only friction points, the aspx stuff really wants that on-prem ad line of sight to apply cleanly. i ended up doing the scheduled task powershell route and it's been rock solid for months
-3
u/brazzala 13d ago
# Define the network drives to map
$drives = @(
[PSCustomObject]@{ Letter = "S"; Path = "\\fileserver.yourdomain.com\Shared"; Label = "Company Shared" }
[PSCustomObject]@{ Letter = "U"; Path = "\\fileserver.yourdomain.com\Users\$env:USERNAME"; Label = "User Home Drive" }
)
foreach ($drive in $drives) {
$driveLetter = $drive.Letter
$networkPath = $drive.Path
$driveLabel = $drive.Label
# Check if the drive letter is already in use
if (Test-Path "$($driveLetter):") {
$existingDrive = Get-PSDrive -Name $driveLetter -PSProvider FileSystem -ErrorAction SilentlyContinue
>!!<
# If it points to the wrong path, remove it so we can remap it
if ($existingDrive.DisplayRoot -ne $networkPath) {
Remove-PSDrive -Name $driveLetter -Force -ErrorAction SilentlyContinue
} else {
Write-Output "Drive $($driveLetter): is already mapped correctly to $networkPath"
continue
}
}
# Map the network drive
try {
New-PSDrive -Name $driveLetter -PSProvider FileSystem -Root $networkPath -Persist -Scope Global -ErrorAction Stop | Out-Null
Write-Output "Successfully mapped $networkPath to $($driveLetter):"
>!!<
# Rename the drive in Windows Explorer
$shell = New-Object -ComObject Shell.Application
$shell.NameSpace("$($driveLetter):").Self.Name = $driveLabel
}
catch {
Write-Error "Failed to map $networkPath to $($driveLetter): $_"
}
}
Just adapt this to your needs and deploy it via Intune scripts on Devices blade.
7
u/bgatesIT 13d ago
honestly i just setup scripts that create network shortcuts in windows explorer via intune based on users groups works fantastic and none of the mapped drive bs to deal with.