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)
  }
Powershell

Avatar of undefined
Last Comment
Chris Dent
ASKER CERTIFIED SOLUTION
Avatar of Chris Dent
Chris Dent
Flag of United Kingdom of Great Britain and Northern Ireland image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Powershell
Powershell

Windows PowerShell is a task automation and configuration management framework from Microsoft, consisting of a command-line shell and associated scripting language built on the .NET Framework. PowerShell provides full access to the Component Object Model (COM) and Windows Management Instrumentation (WMI), enabling administrators to perform administrative tasks on both local and remote Windows systems as well as WS-Management and Common Information Model (CIM) enabling management of remote Linux systems and network devices.

27K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo