Forum Discussion

JosLieben's avatar
JosLieben
Iron Contributor
Jun 08, 2018
Solved

Mapping legacy server shares in Intune on Windows 10 MDM

In a Windows 10 full MDM (AzureAD+Intune) scenario, you’ll move your email, app and file workloads to Office 365 (or alternatives).
 
In your pilot or hybrid phase, you may still need access to certain file shares on your servers, so here’s a simple PowerShell script you can deploy using Intune Device Configuration that maps your desired share. Deploy multiple times for multiple shares (or groups of users).
 
It will create a shortcut in a location you define, so the mapping is always user-driven, it will automatically suggest your user’s AzureAD login as username. You can of course customize the script to your liking if you did not change your local AD upn yet.
 
https://www.lieben.nu/liebensraum/2018/06/mapping-legacy-server-shares-in-your-windows-10-mdm-intune-pilot/
 
  • 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!

9 Replies

  • _jma82's avatar
    _jma82
    Copper Contributor

    JosLieben 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?

  • icelava's avatar
    icelava
    Brass Contributor

    JosLieben 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.

      • icelava's avatar
        icelava
        Brass Contributor

        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

  • nicolonsky's avatar
    nicolonsky
    Brass Contributor

    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

  • 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!

Resources