Last active
January 29, 2019 10:06
-
-
Save KentNordstrom/7d734961a38d8d48118b59b34c1bac36 to your computer and use it in GitHub Desktop.
Redirect to MIM Portal to make it the Welcome Page in the underlying SharePoint.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.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