# First time: save credentials $cred = Get-Credential $cred | Export-Clixml -Path "C:\secrets\drive_cred.xml"
Check if you want the drive to stay connected after you restart your PC. win 11 map drive
| Problem | Solution | |---------|----------| | Drive gone after reboot | ✅ Use Persist:Yes or /persistent:yes + check | | Slow reconnect / timeout | Set HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters → KeepConn =300 sec | | Mapped drive shows red X but works | Ignore – Windows Explorer bug. Or refresh with net use Z: /persist:yes | | Credentials lost after password change | Update stored creds in Credential Manager → Windows Credentials → edit the entry | | Drive not available before user logs in (scheduled tasks) | Use net use with explicit credentials inside task (not drive letter persistent across sessions) | # First time: save credentials $cred = Get-Credential