Convert users from Windows Authentication to Claim using PowerShell

Here is the script to convert users from windows authentication to claim using PowerShell.
In SharePoint sometimes required to use claims authentication of user, at the time if user has window authentication we can convert its authentication into claim identity.
  1. $m = [Microsoft.SharePoint.Administration.Claims.SPClaimProviderManager]::Local  
  2. Add-PSSnapin Microsoft.SharePoint.PowerShell -ea silentlycontinue  
  3. $user="User Name Here"  
  4. Function Get-SPClaim 
  5. {  
  6.    param ([string]$user)  
  7.    $claimType =[Microsoft.SharePoint.Administration.Claims]::SPIdentifierTypes.WindowsSamAccountName  
  8.    return $m.ConvertIdentifierToClaim($user, $claimType)  
  9. }  
It will return claims identity of user. 
X

Build smarter apps with Machine Learning, Bots, Cognitive Services - Start free.

Start Learning Now