Copy group membership from one user to another in AD

Поделиться
HTML-код
  • Опубликовано: 20 авг 2024
  • In this Video you can find two script to copy group membership of one user to other user.
    1) Simple script to use in PowerShell ISE where you can specify both user and run the script to copy membership
    2) Second script you can run in Both ISE and PowerShell which will prompt you to enter user Login ID to copy membership.
    Both script I am giving below so you can use it. Please let me know if you have any problem using this script. Share it with other IT guys so they can make use of it.
    Simple Script
    ====================================================
    $UserToCopy = Get-ADUser -Identity UserName-Properties MemberOf
    $SelectGroup = $UserToCopy.MemberOf
    $SelectGroup | Add-ADGroupMember -Members UserName
    ====================================================
    Script with User ID Prompt
    ====================================================
    $From = Read-Host -Prompt "From User"
    $to = Read-Host -Prompt "To User"
    $CopyFromUser = Get-ADUser -Identity $From -Properties MemberOf
    $Group = $CopyFromUser.MemberOf
    $confirmation = Read-Host "Do you want to Copy Group Membership from $From to $to ? Press 'y' to Proceed or any key to Cancel"
    if ($confirmation -eq 'y') {
    $Group | Add-ADGroupMember -Members $to
    clear
    echo "($From) User's Group Memership has been Copied to User ($to)"
    Pause
    }
    else {
    Write-Host 'Task Cancelled'
    }
    ====================================================

Комментарии • 9

  • @user-sz6if6ch6u
    @user-sz6if6ch6u 4 месяца назад

    Hi swapnil, how to fetch details group membership of all users from a particular OU .??

  • @theoneandonlyjonasv
    @theoneandonlyjonasv Год назад +1

    Great tutorial: well explained and easy to follow. Made my onboarding tasks so much easier.

  • @sudheerandhe
    @sudheerandhe Год назад

    Thanks for the video... instead of giving from user & to user in prompt, can we use a csv file to have both the users or two csv files one for from user and another for to user? Please reply.. was looking for this solution...

  • @divyav5572
    @divyav5572 Год назад +1

    Sir,
    I have a quick question,
    I have a user who has 12 Distribution lists he is added to and now I have another team member who recently joined. Now I want to use a power shell and add all the 12 DLs using the copy profile. Is that possible?
    If yes kindly help me with the script, please.

    • @SwapnilInfotech
      @SwapnilInfotech  Год назад

      Did you check the video below, if not please have a look and let me know if you have any questions.
      ruclips.net/video/x0MUKzYRdS8/видео.html

  • @nobody-P
    @nobody-P 2 года назад +2

    sir need tutorial add users to multiple servers admin groups or RDP groups

    • @SwapnilInfotech
      @SwapnilInfotech  Год назад

      You can watch this video for your requirement
      ruclips.net/video/rrRMSSL913Q/видео.html

    • @nobody-P
      @nobody-P Год назад +1

      @@SwapnilInfotech captain Thank you so much, Dear I am new to Powershell Env am trying to learn from now onwards, this is too useful for administrators. I wish to learn more, your videos are so motivating and can understand them very clearly...