Forum Discussion
Syncing SharePoint Document Libraries on Non-Persistent Virtual Computers
Thank you TonyBryant ! I found this tutorial which has a similar script methodology for synching Sharepoint sites:
https://youtu.be/Zoac9lbUuG0?t=1050
It uses "whoami /upn" to set the UPN variable, which seems to be working for AzureAD accounts:
$userUPN= cmd /c "whoami /upn"
Their script is hosted on GitHub and seems to work well:
https://github.com/tabs-not-spaces/CodeDump/blob/master/Sync-SharepointFolder/Sync-SharepointFolder.ps1
However it may be a bit more complex than is needed with the Error and Success messages being returned. For my purposes having the script run silently is best, so I will likely be using a combo of code from your script and the Intune Training Channel folks.
I have been working on deploying Sharepoint site synchronizations via Intune as a Win32App. Intune does have a feature for mapping Sharepoint sites, but it's ridiculously slow. It takes anywhere from 8 hours to 5 days before the libraries show up on the computer as Synched.