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.

12 Comments

Add a Comment

Your email address will not be published. Required fields are marked *