Help with adding a user copying permissions from another user $RoleDefinition.Name SharePoint 2010 Powershell

Hello,
I need to basically find everyplace 'ADUser1' exists and then add a new 'ADUser2' with the same permissions as the first group.
I have created a script that runs through an entire web app and finds everyplace the AD account is directly given access to and access via a group.  I then need to add the new user and assign the permissions from the first ADUser, copy them. Below
is not the entire script, just where I'm trying to add the new user.  The rest of the script works fine to find the first user.  I'm stuck with this part:  $role = $_.RoleDefinitions[$newRoleDef].  I get an error that I can call a method
on a null valued experssion.. I guess I don't know how to specify to copy the role from the first user, and use it to set the new user?
          #Get the Permissions assigned to user
           $WebUserPermissions=@()
             foreach ($RoleDefinition  in $WebRoleAssignment.RoleDefinitionBindings)
                             $WebUserPermissions += $RoleDefinition.Name +";"
        $newRoleDef = $RoleDefinition.Name
          #write-host "with these permissions: " $WebUserPermissions
          #Send the Data to Log file
          "$($Web.Url) `t Site `t $($Web.Title)`t Direct Permission `t $($WebUserPermissions)" | Out-File C:\Apps\Scripts\Logs\UserAccessReport.csv -Append
    $assignment = New-Object Microsoft.SharePoint.SPRoleAssignment($account)
                $role = $_.RoleDefinitions[$newRoleDef]
                $assignment.RoleDefinitionBindings.Add($role)
                $_.RoleAssignments.Add($assignment)

Hi,
According to your post, my understanding is that you want to copy user permission to another user via PowerShell.
Instead of copy permission to another user, we can get the user permission, assign the permission to a group, then add the other user to the group. Now the user would get the same permssion as this user.
http://get-spscripts.com/2010/07/adding-groups-with-permission-levels-to.html
http://blog.thefullcircle.com/2013/02/create-a-sharepoint-group-with-permissions-and-add-an-ad-group-to-it/
We can also use the third-party tool to achieve the same scenario.
http://permissionsmanager.codeplex.com/
http://www.boostsolutions.com/blog/how-to-copy-permissions-to-other-users-in-sharepoint/
Thanks,
Jason
Jason Guo
TechNet Community Support

Similar Messages

  • Problems copying files from another user that originated from Time Machine

    I bought my wife a new MacBook Pro to replace a 6 or 7 year old iMac, and in the course of setting it up tonight, we've run into a little snag.
    She didn't need or want the vast majority of the stuff on the old drive. So I reinstalled the applications she wanted, and copied a few of her documents. MOST of what she wanted was the iTunes and iPhoto databases.
    I attempted to copy these over via the time machine drive that used to be plugged into the iMac. I was told there are insufficient permissions to do so. No problem. I used Migration Assistant to copy from the external drive, and selected just the items that we wanted copied -- Music and Photos.
    This worked great, except it copied over a new user account that matched the old one (she's using a different/married name now, so the user accounts didn't match up). In and of itself, I couldn't care less if it creates another user as I figured I could always go in, copy what I need from the restored user folder to the new user, and then delete the user account we don't need.
    Unfortunately, that's where I've hit the final snaffu. All the files I need are in a user account for "Heather A" (restored from the Time Machine drive via Migration Assistant). I need to copy those files (Music, Photos in particular) to the user account "Heather T" (the new account we setup when we first booted up the new MBP). However, in Finder, there's a little red circle with a line through it over the icon for those folders within "Heather A", and attempting to even open them (much less copy anything), generates the error "The folder 'Music' can't be opened because you don't have permission to see its contents."
    How do I get around this and/or change the permissions?
    I should note that both the "Heather A" and "Heather T" accounts are administrator accounts, so I'm at a loss as to why this is happening and how to fix it.
    Any help would be greatly appreciated.
    Dan

    Sssuming there still in the transferred account, delete the files you copied over to the new account. Log into the old account, drop all those files and iTunes into her new accounts /Public/Drop Box/, log into the new account, and drag to where you want them. That should resolve the permissions issues.

  • Copying files from another user

    I migrated my files successfully, but not into to my user.  I need these files on my main user and I have no idea how to do this. 

    Have a read here:
    http://pondini.org/OSX/MigrationProblems.html
    http://pondini.org/OSX/Transfer.html
    Might be better/best to start the thing all over and using the Setup Assistant instead of the MIgration Assistant this time:
    Using Setup Assistant on Lion
    Stefan

  • How to copy information from a user account's Security tab of Active Directory User and Computer Security tab to another user account?

    Hi, I'm using vs2012
    Grammatically, by C# code, I need to copy a user account's Security (from ADUC Security tab) and apply it to a new user account I created by code.  My application creates new AD accounts when needed.  I need to duplicate/copy attribute from another
    user account that we use as a base template.  I can copy most other attributes through property["xxxxx"] but how do I copy all that permission access information under the ADUC Security tab?
    How can I do that?  Thank you.
    Thank you

    I would recommend asking them in C# forums: https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=csharpgeneral&filter=alltypes&sort=lastpostdesc
    This posting is provided AS IS with no warranties or guarantees , and confers no rights.
    Ahmed MALEK
    My Website Link
    My Linkedin Profile
    My MVP Profile

  • Help with adding image onclick

    Hey everyone,
    I am making a simple game in AS3 and need help with adding an image once they have click on something.
    On the left of the screen are sentences and on the right an image of a form. When they click each sentence on the left, writing appears on the form. Its very simple. With this said, what I would like to do is once the user click one of the sentences on the left, I would like a checkmark image to appear over the sentence so they know they have already clicked on it.
    How would I go about adding this to my code?
    var fields:Array = new Array();
    one_btn.addEventListener(MouseEvent.CLICK, onClick1a);
    one_btn.buttonMode = true;
    function onClick1a(event:MouseEvent):void
        fields.push(new one_form());
        fields[fields.length-1].x = 141;
        fields[fields.length-1].y = -85;
        this.addChild(fields[fields.length-1]);   
        one_btn.removeEventListener(MouseEvent.CLICK, onClick1a);
        one_btn.buttonMode = false;
        //gotoAndStop("one")
    two_btn.addEventListener(MouseEvent.CLICK, onClick2a);
    two_btn.buttonMode = true;
    function onClick2a(event:MouseEvent):void
        fields.push(new two_form());
        fields[fields.length-1].x = 343.25;
        fields[fields.length-1].y = -85;
        this.addChild(fields[fields.length-1]);
        two_btn.removeEventListener(MouseEvent.CLICK, onClick2a);
        two_btn.buttonMode = false;
        //gotoAndStop("two")

    I don't know where you're positioning the button that should enable/disable the checkbox but for "one_btn" let's just say it's at position: x=100, y=200. Say you'd want the checkbox to be to the left of it, so the checkbox would be displayed at: x=50, y=200. Also say you have a checkbox graphic in your library, exported for actionscript with the name "CheckBoxGraphic".
    Using your code with some sprinkles:
    // I'd turn this into a sprite but we'll use the default, MovieClip
    var _checkBox:MovieClip = new CheckBoxGraphic();
    // add to display list but hide
    _checkBox.visible = false;
    // just for optimization
    _checkBox.mouseEnabled = false;
    _checkBox.cacheAsBitmap = true;
    // adding it early so make sure the forms loaded don't overlap the
    // checkbox or it will cover it, otherwise swapping of depths is needed
    addChild(_checkBox);
    // I'll use a flag (a reference for this) to know what button is currently pushed
    var _currentButton:Object;
    one_btn.addEventListener(MouseEvent.CLICK, onClick1a);
    one_btn.buttonMode = true;
    function onClick1a(event:MouseEvent):void
         // Check if this button is currently the pressed button
         if (_currentButton == one_btn)
              // disable checkbox, remove form
              _checkBox.visible = false;
              // form should be last added to fields array, remove
              removeChild(fields[fields.length - 1]);
              fields.pop();
              // clear any reference to this button
              _currentButton = null;
         else
              // enable checkbox
              _checkBox.visible = true;
              _checkBox.x = 50;
              _checkBox.y = 200;
              // add form
              fields.push(new one_form());
              fields[fields.length-1].x = 141;
              fields[fields.length-1].y = -85;
              this.addChild(fields[fields.length-1]);
              // save this button as last clicked
              _currentButton = one_btn;
         // not sure what this is
        //gotoAndStop("one")
    I'd also centralize all the click handlers into a single handler and use the buttons name to branch on what to do, but that's a different discussion. Just see if this makes sense to you.
    The jist is a graphic of a checkbox that is a MovieClip symbol in your library exported to actionscript with the class name CheckBoxGraphic() is created and added to the display list.
    I made a variable that points itself to the last clicked button, when the "on" state is desired. If I detect the last clicked button was this button, I remove the form I added and the checkbox. If the last clicked button is not this button, I enable and position the checkbox as well as add the form.
    What is left to do is handle the sitation where multiple buttons are on the screen. When a new button is pushed it should remove anything the previous button added. This code simply demonstrates clicking the same button multiple times to toggle it "on and off".

  • How can i copy songs from another library to my itunes library with homesharing?

    How can i copy songs from another library to my itunes library with homesharing?  I see the other libraries, but cannot drag the songs into my library.  The help window says to use the "show menu" at the bottom, but I don't have that menu with itunes 11.

    You can do this in 2 ways.
    1) You can enable the sidebar and you can drag and drop like you used to be able to.  To turn on Sidebar in iTunes 11, go to View > Show Sidebar
    2) Another way is to connect to your Home Share from the drop-down menu from the left (where it says Music) and select your Home Share.  Once you are connected to your Home Share, select Music and you should see a button that says "All Items" and on the right, you should see the Import button.  To copy, select the songs you want to import and then click on Import.

  • Help with adding a hyperlink to a button?

    We have a simple little site we built in Catalyst and everything works great. The only problem is that we cannot figure out how to add a hyperlink to one of the buttons in the animation. We simply want to be able to click on the button and go to another site (the client's Facebook page specifically). Can anyone provide some insight? Thanks!

    The message you sent requires that you verify that you
    are a real live human being and not a spam source.
    To complete this verification, simply reply to this message and leave
    the subject line intact.
    The headers of the message sent from your address are shown below:
    From [email protected] Tue Nov 03 19:08:07 2009
    Received: from mail.sgaur.hosted.jivesoftware.com (209.46.39.252:45105)
    by host.pdgcreative.com with esmtp (Exim 4.69)
    (envelope-from <[email protected]>)
    id 1N5TPy-0001Sp-J1
    for [email protected]; Tue, 03 Nov 2009 19:08:07 -0500
    Received: from sgaurwa43p (unknown 10.137.24.44)
         by mail.sgaur.hosted.jivesoftware.com (Postfix) with ESMTP id 946C5E3018D
         for <[email protected]>; Tue,  3 Nov 2009 17:08:03 -0700 (MST)
    Date: Tue, 03 Nov 2009 17:07:49 -0700
    From: Tvoliter <[email protected]>
    Reply-To: [email protected]
    To: Matthew Pendergraff <[email protected]>
    Message-ID: <299830586.358941257293283616.JavaMail.jive@sgaurwa43p>
    Subject: Help with adding a hyperlink to a button?
    MIME-Version: 1.0
    Content-Type: multipart/mixed;
         boundary="----=_Part_36702_1132901390.1257293269030"
    Content-Disposition: inline
    X-Spam-Status: No, score=-3.4
    X-Spam-Score: -33
    X-Spam-Bar: ---
    X-Spam-Flag: NO

  • Archive applet. Help with adding files to archive, then show.

    I need help with this applet: http://pastebin.com/589064
    The user is supposed to add, remove and open archives with text in it.
    My problem is now the highlited area in the code (the lines with the @@'s).
    This button should list all files i have added to the archive, however when i press the button, i only get a numberlisting. eg, if i have added 4 files to the archive I get: 0123
    However I want the Joptionpane to show a listing of the files in the archive.
    When I press "open" i can choose a file, press add, then open a new file, press add, and then when i click show archive, the filenames of the two files i added, should list through a Joptionpane..as you can see, i've tried, but i'm very unfamiliar with this.

    OK..i've done it
    check out http://pastebin.com/589268
    however, now i'd like to change the code, so that if i try to add to files with the same filename, the applet should show an error message..
    How do i do that, please? :-)

  • How do you copy files from one user to another

    How do you copy files from one user to another user on the same machine?

    open your home folder in finder move file to public, log into other account, click the go tab on the finder menu, select computer, your hard drive (Macintosh HD Default)>Users, the origonal user> public and drag that file to your specified folder.
    hope it works
    Craig.

  • Trouble with permission to open current PDF from one user to another user. what is the cure. i am running nthe current Server and updated Os 10.9.2

    Trouble with permission to open current PDF from one user to another  What is the cure ? I'm running the latest Server and OS 10.9.2.

    I had the same problem.
    Try this.
    https://igppwiki.ucsd.edu/groups/publichelpwiki/wiki/a1538/Howto_Disable_Acrobat _as_the_Safari_PDF_Viewer.html

  • How to copy BEx Workbooks from one user's favourites to another user's

    Is there a way to copy BEx Workbooks (Excel Analyzer) from one user's 'Favourites' to another user's Favourites?
    A user is away on vacation and we need to get at a couple of workbooks that are stored only in that user's Favourites. We do not have access to that user's user id and password.
    We’re on BW version 3.5.

    Thanks Ravi.
    We are aware that if a workbook is assigned to a Role then other users can access the workbook.
    In order to assign the workbook to a Role, we need to be able to see it in the first place.
    The workbook is currently saved only in a specific user's Favourites, and that user is away on vacation. We can not assign it to a Role unless we sign on as that user. We do not have the user's logonid and password.
    So we are still interested in finding out how to copy from that user's Favourites, perhaps via a program or via the Administrator Workbench.

  • Need help with adding emoji to my hubby's phone don't see it when I click on the keyboard tab

    I need help with adding emoji to my hubby's iPhone when I go to settings then the keyboard tab it's not there

    I did that bad it's not there and doesn't give me to option to click on it

  • Help with the iTunes 9, transferring music from older version.

    I have a 2nd generation iPod Nano. I have a new laptop and attempted to download iTunes to manage my music library. I don't listen to the music on the computer just purchase from iTunes and then Sync with my iPod. I'm not good at techology. When I downloaded iTunes onto my new laptop, it deleted all my playlist but my songs are on my iPod just in numerical order.
    I cannot get my Music from my iPod to transfer to the current version of iTunes. I am able to select Sync my iPod and it said Do Not Connect but nothing happpened with my iTunes library. Also, I purchased a song from iTunes and it will not transfer to my iPod.
    Any suggestions other than to keep using my old laptop? I'm not even sure if the Music Library is set up on that computer because in the process of attempting to set up on the new laptop I select to move my Library to the new laptop.

    Syncing music is a one way street with the iPod and that is from iTunes to the iPod and NOT the other way around. The only exception to this rule is with iTunes purchases. You can transfer them back to iTunes by plugging the iPod and choosing File -> Transfer Purchases.
    Otherwise, see this older post from another forum member Zevoneer covering the different methods and software available to assist you with the task of copying content from your iPod back to your PC and into iTunes.
    https://discussions.apple.com/thread/2452022?start=0&tstart=0
    B-rock

  • Error while trying to copy template from another application

    Hi,
    I am getting this error while trying to copy template from another application:
    report error:
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    This report is located here:
    Home-Application Builder-Application 150-Shared Components-Templates-Replace Templates
    best regards,

    It is usually a permissions issue.. you have read but not write permission. Why it would suddenly change is one of those Apple Mysteries... but it happens.
    Open the directory (folder) where your media files are.. and check the permissions.. see if you can fix them.
    The problem is the folder on the TC might have lost your ownership and you might not be able to change it.. Apple do not provide anyway to regain permissions because you would need low level access to the TC firmware.
    I would just as a matter of course reset the TC to factory and redo its setup.
    Factory reset universal
    Power off the TC.. ie pull the power cord or power off at the wall.. wait 10sec.. hold in the reset button.. be gentle.. power on again still holding in reset.. and keep holding it in for another 10sec. You may need some help as it is hard to both hold in reset and apply power. It will show success by rapidly blinking the front led. Release the reset.. and wait a couple of min for the TC to reset and come back with factory settings. If the front LED doesn’t blink rapidly you missed it and simply try again. The reset is fairly fragile in these.. press it so you feel it just click and no more.. I have seen people bend the lever or even break it. I use a toothpick as tool.
    N.B. None of your files on the hard disk of the TC are deleted.. this simply clears out the router settings of the TC.
    Do the setup via airport utility using different names.. short, no spaces and pure alphanumerics. Make sure passwords are also pure alphanumeric mixed case and numbers.. 8-20 characters is usually plenty.
    Mount the disk in finder and see if you have the same issue.. I am not expecting a change.. but it is worth a try.
    No luck you can copy your files off the TC.. wipe it .. and then copy them back.. no bad thing unless you already have a backup of your files at the moment. In which case you can just wipe the TC and copy the files now.

  • Creating Variable with Replacement Path to get value from ANOTHER Variable

    Hi all,
        Is anyone has created the Variable with Replacement Path to get the value from another User Entry Variable, PLEASE ? 
    First created the User Entry Variable (ZV_X) and it accepts the date range like '01/01/2009 - 01/31/2009'. Next created the Characteristic variable (ZV_Y) of Replacement Path for which source variable will be ZV_X and we should get the 'FROM Date' (01/01/2009) from the selection (ZV_X) into it (ZV_Y).
    While creating the Characteristic variable (ZV_Y) of Replacement Path, I didn't find my newly created ZV_X variable in the list of available variables under 'Variable' header in 'Replacement Path' tab and it is causing the error 'Source to replace variable ZV_Y is not defined'. How could I create the Characteristic variable of Replacement Path for my requirement, PLEASE ?
    The following is from help.sap..com:
    Replace with Characteristic Value
    Text and formula variables with the processing type Replacement Path can be replaced with a corresponding characteristic value. In the variable editor, on the General tab page, you specify under Reference Characteristic the characteristic that is to be referenced by the replacement. On the Replacement Path tab page, you can choose whether the variable is replaced with the From or the To Value and with the Key or the Name of the characteristic value. You can also specify the Offset Start and Offset Length for the output.
    Replace with Variable
    Characteristic value variables, hierarchy variables, text variables, and formula variables with the Replacement Path processing type can take their values from a different variable.
    The following prerequisites need to be fulfilled:
    Variable
    ●      The variable must not be input-ready
    ●      The variable must represent a single value
    Source Variable
    ●      The source variable must not be a hierarchy node variable
    ●      The source variable must be input-ready
    ●      The source variable must be available in the query
    ●      The source variable must represent a single value or an interval
    In the variable editor, on the Replacement Path tab page, you specify the source variable from which the value is to be determined. The value is either determined from the key, the external attribute of the key, the description, or the attribute value. You can specify an Offset Start and an Offset Length for the output here. The variable is replaced on the variable screen upon each data release.
    Thanks,
    Venkat.

    Hi Eve,
    It is possible to connect the 2 queries using a Replacement Path characteristic variable. You would need to create the variable on the char whose values you want to pass from Q1 to Q2. The variable will be of type replacement path and you will need to enter the name of Q1 from which it will get the values. Make sure that you include this char in the query definition of Q1 and Q2. In Q2 you will restrict the characteristic using this variable. DO not use this variable (replacement path) in Q1.
    In your query properties check if you have turned on the checkmark for Release for OLE DB for OLAP (3rd tab). If the check mark is there, then remove it.
    We are using the scenario in a couple of places, and it works very well.
    Hope this helps...

Maybe you are looking for

  • My computer died and I have a new one. How do i Authorize my new computer to synch the content of my iPod?

    My computer died and I have a new one. How do i Authorize my new computer to synch the content of my iPod?

  • 865PE NEO2 FSIR fails memory tests

    This is the second MB that I've had this problem with, so something is causing them to fail.  Here's the story: New install, 865PE Neo2 FSIR + P4 2.6GHz 800MHz FSB, 2 x Crucial PC3200 256MB DDR, everything seems ok, XP installs with no problems. Abou

  • My website does not work with Ipad

    I have made a website with dreamwaver CS 5,5 and everything working just fine, but on a Ipad it is sometime problem to open page in the drop meny? Is there anybody who can tell me why it is so? is there any solution ? Greatful for answers Mats

  • Parameters in XI adapter

    Hi all, Can anyone tell me abt the parameters that i need to mention in XI adapter as receiver. thanx, krish

  • Help with date revision

    I have to update several pages quite often and would like to show the revision date on the page. Is there a way I can do this with dreamweaver 8. If not is there a snippet that you know of. Thanks