![]() In Task Scheduler, select Action > Create Task.Copy the script file MapDrives.ps1 to the following location:.Log off, and then log back on to the device to open the mapped drives.A log file (StartupLog.txt) will be created in the %TEMP%\ folder.Copy the script file (MapDrives.ps1) to the following location:.%ProgramData%\Microsoft\Windows\Start Menu\Programs\StartUp Copy the script file (MapDrives.cmd) to the following location:.If the device has not established a network connection by the time of logon, the startup script won't automatically reconnect network drives. This workaround works only for the device that has network access at logon. Executing scripts in an elevated security context will prevent mapped drives from being available in the standard user context. If($error.Count -eq 0 -Or $i -eq 0) Īll workarounds should be executed in standard user security context. ![]() Write-Host "There was an error mapping $MappedDrive.RemotePath to $MappedDrive.LocalPath" New-SmbMapping -LocalPath $MappedDrive.LocalPath -RemotePath $MappedDrive.RemotePath -Persistent $True $MappedDrives = Get-SmbMapping |where -property Status -Value Unavailable -EQ | select LocalPath,RemotePath The file should be run at a regular but not at an elevated command prompt because it should be run at the same privilege as Windows Explorer: $i=3 PowerShell -File "%SystemDrive%\Scripts\MapDrives.ps1" > "%TEMP%\StartupLog.txt" 2>
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |