Skip to main content

How do we deploy SharePoint sites with Microsoft Intune? In this blog post we will deploy SharePoint sites and also create a remediation script to make the installation as smooth as possible. Let’s get started.

What are we going to set up?

In the first step, we will create an configuration profile with the SharePoint Library. However, the SharePoint sites can take up to 8 hours to install on the device. That is definitely to long! To speed this up, we will create a remediation script in the second step to speed up the process.

Create Configuration profile

First we need to copy the Library ID from the SharePoint sites we want to deploy. Follow these steps:

  • Navigate to the SharePoint site you want to deploy.
  • Go to your documents library.
  • Click on Sync
  • A windows should open. Click on the Copy library ID

Save this library ID. We need this in the next step. Gather all SharePoint library ID you want to deploy and go to the next step.

  • Go to intune.microsoft.com
  • Navigate to Devices
  • Click on Windows
  • Click on Configuration profiles
  • Click on Create profile
  • Platform: Windows 10 and later
  • Profile type: Settings catalog
  • Click on Create
  • Enter a Name 
  • Enter a Description
  • Click on Next
  • Click on Add settings
  • Search for libraries
  • Click on OneDrive
  • Choose Configure team site libraries to sync automatically (User)
  • Enable the setting

In the libraries settings you have two collums.

  • In the Name field enter the SharePoint site name.
  • In the Value enter the Library ID which we have copied in the last step.
  • Add for every SharePoint site you want to deploy one entry.
  • When you are finished click on Next
  • In the Scope tags tab, enter the scope when applicable. Click on Next.
  • On the Assignments tab, add the groups or all users/devices. Click on Next.
  • On the Review + create tab click on Create

If the policy is now installed on a device, it can take up to 8 hours before it is actually visible to the user. To speed up this process a little, we will upload a remediation script in the second step. This will reduce the waiting time to about 1-2 hours.

Create Remediation script

Unfortunately, the configuration above can take up to 8 hours before it is actually visible to the user. To speed up this process a little, we will upload a remediation script in the second step. This will reduce the waiting time to about 1-2 hours. Follow this steps:

  • Create a new PowerShell script
  • Copy the script below
$Path = "HKCU:\SOFTWARE\Microsoft\OneDrive\Accounts\Business1"
$Name = "TimerAutoMount"
$Type = "QWORD"
$Value = 1
Set-ItemProperty -Path $Path -Name $Name -Type $Type -Value $Value

  • Save this PowerShell script. I named it RemediateOnedriveAutoMountSetting.ps1
  • We need to create a second PowerShell script (detectionscript). Create another one and copy the script below.
$Path = "HKCU:\SOFTWARE\Microsoft\OneDrive\Accounts\Business1"
$Name = "TimerAutoMount"
$Type = "QWORD"
$Value = 1
Try {
$Registry = Get-ItemProperty -Path $Path -Name $Name -ErrorAction Stop | Select-Object -ExpandProperty $Name
If ($Registry -eq $Value){
Write-Output "Compliant"
Exit 0
} 
Write-Warning "Not Compliant"
Exit 1
} 
Catch {
Write-Warning "Not Compliant"
Exit 1
}

 

  • Save this script. I named it DetectOneDriveAutoMountSetting.ps1

We are now going to upload the two scripts to Intune.

  • Go to intune.microsoft.com
  • Navigate to Devices
  • Click on Windows
  • Click on Scripts
  • Click on Remediations
  • Click on Create

In the Basics tab, enter the following properties:

  • Enter a Name 
  • Enter a Description
  • Click on Next

On the Settings tab enter:

  • Detection script file: Upload the DetectOneDriveAutoMountSettings.ps1 file.
  • Remediation script file: Upload the RemediateOneDriveAutoMountSetting.ps1 file.
  • Run this script using the logged-on credentials: Yes
  • Enforce script signature check: No
  • Run script in 64-bit PowerShell: Yes

When you are finished click on Next

  • On the Scope tab, add a scope if applicable. Click on Next.
  • On the Assignments tab, add the groups or all users/devices. Click on Next.
  • On the Review + create tab click on Create

Congratulations! You have successfully deployed the policy.

The configuration profile will install the SharePoint pages. So that the installation does not take 8 hours, the Remedation script will change a registry entry. This makes it possible to install the SharePoint sites within 1-2 hours. Unfortunately, there is no way to do this faster.

Conclusion

You learned how to deploy SharePoint sites with Microsoft Intune. First, we copied the SharePoint library ID and created a configuration profile. In the second step we created a remediation script to speed up the proccess.

Did you enjoy this article? Don’t forget to follow us and share this article. You may also like the following articles.

Leave a Reply