Avatar of zanderkid
zanderkid
Flag 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)
  }
Powershell

Avatar of undefined
Last Comment
Chris Dent

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Chris Dent

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy