Please Read: Significant Update Planned, Migrating Forum Software This Month

See more
See less

Need help adding more groups to exclusion list

  • Filter
  • Time
  • Show
Clear All
new posts

  • Need help adding more groups to exclusion list

    i found and modified the script below and was wondering if i can add more groups that i want to exlude from copying from the source user to destination user. Can you assist? Also, what editor can i use to show me the output of each line as it's executing?


    write-output "This script helps to add user to all the Groups which other user is memberof.It is can be normally used when new user needs to have all the group membership of the existing users" 
    write-output " " 
    write-output " " 
    $SName = Read-Host "Please Enter the alias name of the source user " 
    $DName = Read-Host "Please Enter the alias name of the Destination user " 
    $EXName = Read-Host "Please Enter the name of the group you want to exclude "
    $K = Get-QADUser $SName |Select-Object -ExpandProperty MemberOf | Get-ADGroup -Properties name | Where SamAccountName -ne $EXName | Select-Object SamAccountName
    foreach($user in $K.SamAccountName)  
    Add-QADGroupMember -Identity $user -Member $DName 
    Last edited by Rems; 19th August 2013, 22:44. Reason: added [code] tags

  • #2
    Re: Need help adding more groups to exclusion list

    First lets clarify what you are trying to accomplish. It appears you simply want to add one user to all the groups a reference user is a member of, with the ability to exclude groups based on a manifest... is this correct?

    That powershell script uses the Quest AD powershell modules, which you have to download and install...
    Rules of life:
    1. Never do anything that requires thinking after 2:30 PM
    2. Simplicity is godliness
    3. Scale with extreme prejudice

    I occasionally post using a savantphone, so please don't laugh too hard at the typos...