Link to home
Start Free TrialLog in
Avatar of zanderkid
zanderkidFlag for United States of America

asked on

Powershell script to migrate user from one domain to another then move them to a new group on the new domain

#get list of groups the user belongs to
$GroupNames = Get-QADMemberOf "TestMigration6" -Service "microsoft1.contoso.com" | Select-Object -ExpandProperty Name

#Move the user via admt from domain microsoft1.contoso.com to microsoft2.contoso.com
admt user /N "user1" /IF:YES /MGS:NO /SD: "microsoft1" /TD: "microsoft2" /TO:"test users" /UUR:YES /PO:Complex /FGM:YES

#add user to the groups in microsoft2.contoso.com
$GroupNames | ForEach-Object { Add-QADGroupMember $_ -Member "user1" -Service "microsoft2.contoso.com" }


#this step I need to take it a step further to move the users from the groups they were placed in microsoft2.contoso.com and move them to a group with the same name only GBL_FLS_ is now in front of the name. the example is using dsget but I would like to continue with powershell.
dsgetgroup "$GroupNames" -members | dsmod group "GBL_FLS_$GroupNames
ASKER CERTIFIED SOLUTION
Avatar of Neil Russell
Neil Russell
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Sorry yes, you already have Quest