Idera nSoftware Compellent

Powershell to Copy Group Members from One User to Another


posted by Krishna
01-19-2010

Downloads: 177
File size: 621 B
Views: 1,542

Embed
Powershell to Copy Group Members from One User to Another
  1. Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin 
  2. Add-PSSnapin Quest.ActiveRoles.ADManagement 
  3. cls 
  4. 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" 
  5. write-output " " 
  6. write-output " " 
  7. $SName = Read-Host "Please Enter the alias name of the source user " 
  8. $DName = Read-Host "Please Enter the alias name of the Destination user " 
  9.  
  10. $K = Get-QADUser $SName |select memberof  
  11. foreach($user in $K.memberof)  
  12. {  
  13. Add-QADGroupMember -Identity $user -Member $DName 
Copyright 2010 PowerShell.com. All rights reserved.