Next, paste in the script below to the text window, and ensure that “Run script as user” is the only option checked.
if (-not(get-psdrive -name "Z" -ErrorAction SilentlyContinue)) {
New-PSDrive -name "Z" -PSProvider FileSystem -Root \\server\share -Persist
}
Remember to edit the script to match what is needed for your environment, replacing “Z” with the drive letter you wish to map, for example if you want to map H: then replace “Z” with “H”. Also, replace \\server\share with the UNC path of the share you wish to map.
The “On apply action” screen should look similar to below:
Test the policy by logging into a domain-joined computer with a domain user account from the (User) OU or Domain where this GPO is linked then run “gpupdate”, afterward open File Explorer and verify that you see the new drive mapping.
Tip: If using PolicyPak Scripts Manager VPN Triggers to map drives on VPN connect you may need to add a delay to allow DNS to be updated before the drives are mapped, (i.e. to wait 15 seconds use "Start-Sleep -s 15" for PowerShell, or "Timeout /T 15 >nul" for Batch files.
If you do not see the drive mapping in File Explorer but can see the drive mapping when running "Net Use" from the CMD prompt try enabling the "Launch folder windows in a separate process" option (see image below) to see if that resolves the issue.