Jun 08 2018 06:12 AM - edited Jun 27 2021 10:29 AM
Jul 03 2018 10:24 AM
SolutionI 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!
Jan 11 2019 01:58 PM - edited Jan 11 2019 01:59 PM
Hi guys, I've had the same challenge and came up with this solution: https://tech.nicolonsky.ch/intune-execute-powershell-script-on-each-user-logon/. Hope it helps you. @Kevin Kaminski
Mar 11 2020 12:51 AM
@Jos Lieben Is there a configuration that can map drives to network shared folders for SYSTEM context?
e.g. Lenovo Vantage runs as a service in SYSTEM context, and can be configured to access a custom UNC path instead of Lenovo's regular support center web site. However that means it does not use any user's credentials or Windows session, and none of their mapped drives.
Mar 12 2020 07:38 AM
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
Mar 13 2020 03:55 AM
@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
May 06 2021 11:32 PM
@Jos Lieben Hi,
i try to get this https://tech.nicolonsky.ch/next-level-network-drive-mapping-with-intune/ drive map script to work. on that log i see error message:
PS>TerminatingError(New-PSDrive): "The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Verkkoresurssin laji ei ole oikea (with is in english something like The type of network resource is incorrect. Does someone know what that means?
May 06 2021 11:41 PM
May 07 2021 12:57 AM
Jun 11 2021 06:22 AM
@Rudy_Ooms_MVP thank you! This is exactly what I've been looking for, the best solution for our environment.
Jul 03 2018 10:24 AM
SolutionI 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!