Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Redirect to MIM Portal to make it the Welcome Page in the underlying SharePoint.
<#
.SYNOPSIS
Script to Redirect to /IdentityManagement on MIM Portal Server.
Defaults to expecting the only SPSite to be MIM Portal Site.
Intended to be run from SharePoint Management Shell.
Users need Read Access to RootFolder for this to work.
Script gives Read to Authenticated Users by default.
#>
PARAM([string]$MIMWebUrl,[bool]$AddAuthenticatedUsers = $true)
if($MIMWebUrl){ $SPWeb = Get-SPWeb $MIMWebUrl}
else{$SPWeb = (Get-SPSite).RootWeb}
$RootFolder = $SPWeb.RootFolder
$RootFolder.WelcomePage = "IdentityManagement/default.aspx"
$RootFolder.Update()
if($AddAuthenticatedUsers){
#Adding Authenticated Users with Read Access to the SPWeb
$AuthenticatedUsers = New-Object Microsoft.SharePoint.SPRoleAssignment("NT AUTHORITY\Authenticated Users",$null,"Authenticated Users",$null)
$AuthenticatedUsers.RoleDefinitionBindings.Add($SPWeb.RoleDefinitions["Read"])
$SPWeb.RoleAssignments.Add($AuthenticatedUsers)}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment