User-A will be replaced by User-B. Now, User-A is like to duplicate his permission, means that User-B should be provided with the same permission as User-A however User-B’s existing permission should not be disturbed.
I guess, Move-SPuser wont help here.
any help(without any 3rd party tool)?
3rd party tool - http://lightningtools.com/products/deliverpoint-2010/
Update $filePath = "D:\temp\Logs\UserPermission.txt";
function Logs($log) { $log | out-file $filePath -append; }
function Get-SPUserPermissions([string]$webAppurl, [String]$sourceSPUser, [String]$targetSPUser ) { $spWebApp = Get-SPWebApplication -Identity $webAppurl;
Logs "Processing webapplication : $webAppurl"
$spWebApp.Sites |% {
$spSite = $_;
Logs "Processing site : $spSite "
$spSite.AllWebs |% {
$spweb = $_;
if ( $spweb.IsRootWeb -eq $True -or $spweb.HasUniquePerm -eq $True) {
Logs "Processing Web : $spweb"
$spUser1 = $spweb.SiteUsers[$sourceSPUser];
if ($spUser1 -ne $null) {
$spUser2 = $spweb.EnsureUser($targetSPUser);
try {
if($spUser2 -ne $null) {
$spUser1.Roles |% {
$Role = $_;
Logs "Processing Role : $Role.Name "
$Role.AddUser($spuser2);
}
$spUser1.Groups |% {
$Group = $_;
Logs "Processing Group : $Group.Name"
$Group.AddUser($spuser2);
}
}
}
catch {
Logs "Error : $_.Exception.ToString()"
}
}
}
$spWeb.Dispose();
}
$spSite.Dispose();
}
}
Get-SPUserPermissions "http://webapplication/" "user1" "user2"
