Tell me more ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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"

share|improve this question
What you exactly mean by "replace" ? Every user is treated unique in SharePoint based on their login id. – Arko D Jul 27 '12 at 13:22

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.