Search This Blog

Wednesday, July 5, 2017

Disable Mysite Provisioning in SharePoint using Powershell

Disable Mysite Provisioning in SharePoint using Powershell

Add-PSSnapIn Microsoft.SharePoint.PowerShell -EA 0 
function DisableMySiteCreation([string]$UserProfileProxyName)
 { 
$upaproxy = Get-SPServiceApplicationProxy | Where-Object {$_.DisplayName -eq $UserProfileProxyName} $upasecurity = Get-SPProfileServiceApplicationSecurity -ProfileServiceApplicationProxy $upaproxy $authuser = New-SPClaimsPrincipal -Identity 'c:0(.s|true' -IdentityType EncodedClaim $ntauthusers = New-SPClaimsPrincipal -Identity 'c:0!.s|windows' -IdentityType EncodedClaim $localAuthUsers = New-SPClaimsPrincipal "NT AUTHORITY\Authenticated Users" - IdentityType WindowsSamAccountName Revoke-SPObjectSecurity -Identity $upasecurity -Principal $authuser -Rights "Create Personal Site" Revoke-SPObjectSecurity -Identity $upasecurity -Principal $authuser -Rights "Use Personal Features" Revoke-SPObjectSecurity -Identity $upasecurity -Principal $authuser -Rights "Use Social Features" Revoke-SPObjectSecurity -Identity $upasecurity -Principal $ntauthusers -Rights "Create Personal Site" Revoke-SPObjectSecurity -Identity $upasecurity -Principal $ntauthusers -Rights "Use Personal Features" Revoke-SPObjectSecurity -Identity $upasecurity -Principal $ntauthusers -Rights "Use Social Features" Set-SPProfileServiceApplicationSecurity -Identity $upasecurity - ProfileServiceApplicationProxy $upaproxy
}
DisableMySiteCreation "User Profile Service Application"


No comments:

Post a Comment