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

asked on

Powershell and sid history

Currently we are using the following script to move users via intraforest from servera to server b.  I need a way to transfer the sid history from server a to server b as well.  

$GroupNames = Get-QADMemberOf "Username" -Service "domainA.com" | Select-Object -ExpandProperty Name
admt user /N "Username" /IF:YES /MGS:NO /SD: "domainA.com" /TD: "domainB" /TO:"server users" /UUR:YES /PO:Complex /FGM:YES
$GroupNames | ForEach-Object { Add-QADGroupMember $_ -Member "username" -Service "domainB" }
I found the following script online but do not know how to integrate it into the script to move the users.
function Add-SidHistory {
  Param($sourceDC,$sourceDomain,$sourceUsername,$targetDC,$targetDomain,$TargetUsername)
  $clonePrincipal = New-Object -COMObject DSUtils.ClonePrincipal
  $clonePrincipal.Connect($sourceDC,$sourceDomain,$targetDC,$targetDomain)
  $clonePrincipal.AddSidHistory($sourceUsername,$targetUsername,0)
  }
ASKER CERTIFIED SOLUTION
Avatar of Chris Dent
Chris Dent
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