Create a drive mapping using Intune on Azure AD joined devices (Manual)
With the transition to Azure AD, you might want to connect your AAD joined devices to the traditional file server as explained in this article: Go Azure AD Joined with on-prem DC and fileserver The next step is to map some network drives with Intune!
Step 1: The first step is to create a PowerShell script that will do the actual drive mappings. This script will be placed on a Azure Blob storage (or your internal domain) where you will be able to manage and maintain the script. This script will be run using a second script that we will deploy with Intune. For your convenience I’ve already prepared the script:
You will need to change a few lines, the first one is the internal domain name of your domain. The second part to change is the actual drive letters, change this to your own needs, duplicate or remove blocks where required. Run the PowerShell script on a test laptop to verify that it’s working as it should.
Step 2: Now that we have a tested and working script, we will upload it to Azure. First create a storage account. From there go to Blobs, and add a new container
Give the container the name drivemapping, or anything that you like 😉 Make sure you enable anonymous read access for blobs only
Now upload your PowerShell script…
Once uploaded, copy the public URL and save it. We will need it in the next script.
Step 3: Now that we have prepared our DriveMapping script we are going to deploy the execution script to all clients using another script that we will deploy using Intune. So, again I made it easy, here is script 2:
This script is a quick one to edit, just change line 2 with the URL you copied from step 2:
Step 4: Now we will need to deploy the DeployDriveMappingPS script to all devices. So open the Azure Portal and go to Microsoft Intune, Device configuration, and add a PowerShell Script.
Give the script a logical name
Next we will configure Script settings, import in this step is to slide the Run this script using the logged on credentials to Yes
Now review the assignments, for this manual we decided to deploy it to all users.
Last is to click add, and verify the deployment to your computers, and verify drive mapping.
have you ever tried to deploy a Azure File Share Mapped Drive with Intune?
I did not, but it shouldn’t be to hard. Question is, how to make sure that you can securely connect?
In the future I will definitely look in to it.
Cor
I am trying this now, and even though the script is succeded on the device, I get no mapped network drive. If i manually run the first powershell script, the drive is mapped just fine.
Any ideas on how to make this drive mapping work from Intune?
Can i map a share from a local NAS too with a intune PS Script?
That should certainly be possible, depending on your NAS and configuration
Works almost.
My problem is I have new users that are just Azure AD, but my network shares are on-prem AD.
When the script runs under their credentials they don’t have an account on the local AD.
How do I run the script with a local user’s credentials?
Seems like there should be a Powershell Invoke way to do this.
If your share is on-prem, with AD connected, it will not work. You should create local accounts and merge them with the accounts in Azure AD.
If the user is locally connected on their work network, this will work
BUT
If the user at remote location with no access to the work network, will this still map the drive?
If the user is at a remote location, without access to the network, it will not map the drive, as there is no access to the SMB path.
ACE! Works great, thanks!
Hello ! Thank you for this great tutorial but I can’t see / download the Powershell scripts :/
Thank you in advance.
Oops, my subscription was shutdown because of overusage. It should be available again on the 12th of november!