Synchronize SharePoint sites with Intune & PowerShell

I recently spent some time with my colleague and frequent collaborator Steven Hosking. We spoke about a solution I came up with to synchronize SharePoint sites to devices using PowerShell & Intune.

This is something I’ve had in my drafts for quite a while, but it kept ending up being too long to write about. As it turns out, Steve ( and Adam) runs a very valuable and informative youtube channel that is dedicated to everything that is “Intune”.

As the solution I wrote for this is directly linked with Intune, we figured it’d be perfect for the channel. We decided to film this little video to show how my solution works better than the official one provided by Microsoft.

To summarize everything in the video:

  • SharePoint sites can be synchronized natively through Intune Administrative Template Policies
  • The native policy has a URI character limit which is very easy to hit
  • Capturing the details required to sync SharePoint sites is very easy using Chrome / Edge Chromium
  • Using PowerShell can overcome current limitations with the native policy solutions.

Here is a link to the code mentioned in the video – if anyone wants further info, please let me know!

Enjoy!

– Ben

4 comments

  1. Sami Karhula Reply
    March 25, 2020 at 11:46 am

    Hi, Thanks for sharing information. I PS script work on intune to deploy SPO site automatically. SPO site shows on test computer but Intune portal show error on deploy PS Script. Did you get this issue? SiteID, WebID, listID is taken same way what is on video.

  2. Humberto Jorquera Reply
    April 5, 2020 at 10:53 am

    Hi Sami, seems like I had the same issue last night. I’ll give it another try tonight, I’m not sure about what am I doing wrong.

  3. Humberto Jorquera Reply
    April 5, 2020 at 11:40 am

    Hey mate,

    I just made it work, in my the error was quite stupid.
    I just followed the video without truly understanding what Ben was explaining, and I converted the parameters in the hash table into variables (minute 26:24 in the video), Ben did this for demonstration purposes as he wasn’t gin to run the entire function, but hen you intend to push this script via intune, you only need to change the value of the parameters but lave the parameter names alone.

    • Sami Karhula Reply
      April 6, 2020 at 7:30 am

      Hi,

      I only change params below. Not convert those to variables as a video. Still get same error. Library synced without problem but intune portal shows failed status.
      try {
      #region Sharepoint Sync
      [mailaddress]$userUpn = cmd /c “whoami/upn”
      $params = @{
      #replace with data captured from your sharepoint site.
      siteId = “{00000000-0000-0000-0000-000000000000}”
      webId = “{00000000-0000-0000-0000-000000000000}”
      listId = “{00000000-0000-0000-0000-000000000000}”
      userEmail = $userUpn
      webUrl = “https://example.sharepoint.com”
      webTitle = “Title”
      listTitle = “FolderName”
      }

Leave A Comment

Please be polite. We appreciate that. Your email address will not be published and required fields are marked