#[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
#Add-PSSnapin
Microsoft.SharePoint.Powershell -ErrorAction SilentlyContinue
#add-pssnapin
Microsoft.SharePoint.Powershell
<#
Users.csv has list of all user names.
UserName
Suryap
Ravik
Johnp
#>
Copy below code and save it as .ps1 file. Open PowerShell
window, run below script.
It will remove provider name from FBA user name.
$InputFile = "d:\surya\Users.csv"
$URL= "http://spdev5:8003"
$site = New-Object Microsoft.SharePoint.SPSite($URL)
$web = $site.openweb("")
$file = ipcsv $InputFile
$i = 1
#variables
$fbaUserName= $null
$fbaformattedlogin = $null
foreach ($line in $file)
{
$fbaUserName = $line.UserName #.csv file column name
# update 'scmemberprovider' with
your provider name
$fbaformattedlogin = "i:0#.f|scmemberprovider|" + $fbaUserName
Set-SPUser $fbaformattedlogin -Web $URL
-DisplayName $fbaUserName
#Get-SPUser $fbaformattedlogin -Web $URL
# $i++
# if($i -eq 4)
#{
# break;
#}
}
$web.Dispose()
$site.Dispose()
No comments:
Post a Comment