Forum Discussion
Mapping legacy server shares in Intune on Windows 10 MDM
- Jul 03, 2018
I wish I saw this earlier because I ended up making my own. Looks like this one has some more feature rich than what I wrote. Great job!
You could try executing the map share file command with psexec
https://stackoverflow.com/questions/77528/how-do-you-run-cmd-exe-under-the-local-system-account
Thijs Lecomte I've learnt how to deal with it using the Scheduled Tasks avenue to map on OS startup. 🙂 After fiddling with schtasks a while, eventually went the Powershell route because it's got more granular control over power/battery conditions.
$taskName = "MapDrive_ForSYSTEM"
Unregister-ScheduledTask -TaskName $taskName -Confirm:$false -ErrorAction Ignore
$stAction = New-ScheduledTaskAction -Execute "net" -Argument "use S: http://127.0.0.1 /persistent:yes /user:.\username password"
$stTrigger = New-ScheduledTaskTrigger -AtStartup
$stPrincipal = New-ScheduledTaskPrincipal -UserId "NT AUTHORITY\SYSTEM" -LogonType ServiceAccount
$stSettings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries
$st = New-ScheduledTask -Action $stAction -Trigger $stTrigger -Principal $stPrincipal -Settings $stSettings
Register-ScheduledTask -TaskName $taskName -InputObject $st