Skip to content

Instantly share code, notes, and snippets.

@mavaddat
Last active August 4, 2023 19:55
Show Gist options
  • Save mavaddat/3125885c07760e3c6d84fa81250fc6d3 to your computer and use it in GitHub Desktop.
Save mavaddat/3125885c07760e3c6d84fa81250fc6d3 to your computer and use it in GitHub Desktop.
Set OneDrive and SharePoint trusted zones
#Requires -RunAsAdministrator
$zones = "onedrive.com", "*.onedrive.com", "onedrive.live.com", "login.live.com", "g.live.com", "spoprod-a.akamaihd.net", "*.mesh.com", "p.sfx.ms", "oneclient.sfx.ms", "*.microsoft.com", "fabric.io", "*.crashlytics.com", "vortex.data.microsoft.com", "posarprodcssservice.accesscontrol.windows.net", "redemptionservices.accesscontrol.windows.net", "token.cp.microsoft.com/", "tokensit.cp.microsoft-tst.com/", "*.office.com", "*.officeapps.live.com", "*.aria.microsoft.com", "*.mobileengagement.windows.net", "*.branch.io", "*.adjust.com", "*.servicebus.windows.net", "vas.samsungapps.com", "odc.officeapps.live.com", "login.windows.net", "login.microsoftonline.com", "*.files.1drv.com", "*.onedrive.live.com", "*.*.onedrive.live.com", "storage.live.com", "*.storage.live.com", "*.*.storage.live.com", "*.groups.office.live.com", "*.groups.photos.live.com", "*.groups.skydrive.live.com", "favorites.live.com", "oauth.live.com", "photos.live.com", "skydrive.live.com", "api.live.net", "apis.live.net", "docs.live.net", "*.docs.live.net", "policies.live.net", "*.policies.live.net", "settings.live.net", "*.settings.live.net", "skyapi.live.net", "snapi.live.net", "*.livefilestore.com", "*.*.livefilestore.com", "storage.msn.com", "*.storage.msn.com", "*.*.storage.msn.com"
foreach($uri in $zones){
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMapKey" -Name $uri -Value 2 -PassThru
}
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMapKey" -Name "https://bombardierinc-my.sharepoint.com/:w:/g/personal/$($(whoami /upn) -replace '\W','_')" -Value 1 -PassThru
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment