diff --git a/IntuneDriveMapping/wwwroot/bin/IntuneDriveMappingTemplate.ps1 b/IntuneDriveMapping/wwwroot/bin/IntuneDriveMappingTemplate.ps1 index 92974d0..f1ee4fa 100644 --- a/IntuneDriveMapping/wwwroot/bin/IntuneDriveMappingTemplate.ps1 +++ b/IntuneDriveMapping/wwwroot/bin/IntuneDriveMappingTemplate.ps1 @@ -176,6 +176,8 @@ if (-not (Test-RunningAsSystem)) { #if label is null we need to set it to empty in order to avoid error if ($null -eq $drive.Label) { $drive.Label = "" + } elseif ($drive.Label -match '\$env:') { + $drive.Label = $ExecutionContext.InvokeCommand.ExpandString($drive.Label) } $exists = $psDrives | Where-Object { $_.Path -eq $drive.Path -or $_.DriveLetter -eq $drive.DriveLetter } @@ -314,4 +316,4 @@ if (Test-RunningAsSystem) { ########################################################################################### # Done -########################################################################################### \ No newline at end of file +###########################################################################################