API Reference
Command
Invoke-ADXMigrationPlan
Executes or previews an AD migration plan.
Examples
Example 1: Build and preview a migration plan without changing AD.
$plan = New-ADXMigrationPlan -SourceDomain old.contoso.com -DestinationDomain new.contoso.com -SourceDomainController old-pdc.old.contoso.com -DestinationDomainController new-dc01.new.contoso.com -DestinationOrganizationalUnit 'OU=Migrated,DC=new,DC=contoso,DC=com' -SourceAuditReady -SourceTcpipClientSupportReady -ResourceAclScanCompleted -BusinessJustification CAB-1234 {
New-ADXMigrationUser -SourceSamAccountName alice -CredentialStrategy ResetRandom -MigrateMembership
New-ADXMigrationResource -Path '\\FS1\Finance' -ReAclMode AddDestinationBeforeRemoveSource
}
$preview = $plan | Invoke-ADXMigrationPlan
$preview.Phases | Format-Table Kind, Item, Status, Changed, Message -AutoSize
Example 2: Validate, preview, and then apply supported phases with governance metadata.
if ($plan | Test-ADXMigrationPlan) {
$preview = $plan | Invoke-ADXMigrationPlan
$preview.Phases | Format-Table Kind, Item, Status, Changed, Message -AutoSize
$result = $plan | Invoke-ADXMigrationPlan -Intent read_write -AllowWrite -Apply -WriteExecutionId mig-2026-001 -WriteActorId pklys -WriteChangeReason CAB-1234 -WriteRollbackPlanId rollback-CAB-1234 -WriteAuditCorrelationId ([guid]::NewGuid().ToString()) -ArtifactDirectory 'C:\MigrationArtifacts'
$result.Phases | Where-Object Kind -eq Validate | Format-Table Item, Status, Message -AutoSize
$result.Phases | Where-Object Kind -eq Validate | Select-Object -ExpandProperty Checks | Format-Table Code, Success, Message -AutoSize
}
Example 3: Apply only after validation and review of SIDHistory prerequisites.
if ($plan | Test-ADXMigrationPlan) {
$plan.Phases | Where-Object Kind -eq SidHistory | Format-Table Item, Description -AutoSize
$plan | Invoke-ADXMigrationPlan -Intent read_write -AllowWrite -Apply -WriteExecutionId mig-2026-001 -WriteActorId pklys -WriteChangeReason CAB-1234 -WriteRollbackPlanId rollback-CAB-1234
}
Example 4: Review post-apply validation for destination objects, SIDHistory, memberships, and resources.
$result = $plan | Invoke-ADXMigrationPlan -Intent read_write -AllowWrite -Apply -WriteExecutionId mig-2026-001 -WriteActorId pklys -WriteChangeReason CAB-1234 -WriteRollbackPlanId rollback-CAB-1234
$result.Phases |
Where-Object Kind -eq Validate |
Format-Table Item, Status, Message -AutoSize
$result.Phases |
Where-Object Kind -eq Validate |
Select-Object -ExpandProperty Checks |
Format-Table Code, Success, Message -AutoSize
Example 5: Apply a plan that uses runtime credential secrets and offline-domain-join artifacts.
$secrets = @{ 'vault://migration/CAB-1234/bob-temp' = (Get-Secret -Name 'migration/CAB-1234/bob-temp' -AsPlainText) }
$plan | Invoke-ADXMigrationPlan -Intent read_write -AllowWrite -Apply -CredentialSecret $secrets -ArtifactDirectory 'C:\MigrationArtifacts\CAB-1234' -WriteExecutionId mig-2026-001 -WriteActorId pklys -WriteChangeReason CAB-1234 -WriteRollbackPlanId rollback-CAB-1234
Example 6: Apply a machine-side profile phase on the workstation after the domain transition is ready.
$plan | Test-ADXMigrationPlan -PassThru | Select-Object -ExpandProperty Phases | Where-Object Kind -eq Profile | Format-Table Kind, Item, RequiresMachineExecutor, Description -AutoSize
$plan | Invoke-ADXMigrationPlan -Intent read_write -AllowWrite -Apply -EnableLocalProfileMigration -WriteExecutionId mig-2026-001-pc001 -WriteActorId pc001-local-admin -WriteChangeReason CAB-1234 -WriteRollbackPlanId rollback-CAB-1234
Example 7: Apply an offline-domain-join artifact on the destination computer.
$plan | Invoke-ADXMigrationPlan -Intent read_write -AllowWrite -Apply -ArtifactDirectory 'C:\MigrationArtifacts\CAB-1234' -EnableLocalComputerJoin -WriteExecutionId mig-2026-001-pc001 -WriteActorId pc001-local-admin -WriteChangeReason CAB-1234 -WriteRollbackPlanId rollback-CAB-1234
Common Parameters
This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.
For more information, see about_CommonParameters.
Syntax
Invoke-ADXMigrationPlan -Plan <AdMigrationPlan> [-AllowWrite] [-Apply] [-ArtifactDirectory <string>] [-CredentialSecret <Hashtable>] [-DryRun] [-EnableLocalComputerJoin] [-EnableLocalProfileMigration] [-Intent <string>] [-MachineTask <ComputerJoin|ProfileMigration>] [-TargetComputerName <string>] [-WriteActorId <string>] [-WriteAuditCorrelationId <string>] [-WriteChangeReason <string>] [-WriteExecutionId <string>] [-WriteRollbackPlanId <string>] [-WriteRollbackProviderId <string>] [<CommonParameters>]#Parameters
- Plan AdMigrationPlan
- Migration plan to execute or preview.
- AllowWrite SwitchParameter
- Explicitly allows write execution when combined with Apply and read_write intent.
- Apply SwitchParameter
- Applies supported mutating phases.
- ArtifactDirectory string
- Directory for execution artifacts such as offline-domain-join blobs.
- CredentialSecret Hashtable
- Runtime credential secrets keyed by credential secret reference. The plan stores references only; execution receives the secret values.
- DryRun SwitchParameter
- Runs the plan without applying changes.
- EnableLocalComputerJoin SwitchParameter
- Allows an offline-domain-join artifact to be applied to the local computer. Use only on the destination endpoint.
- EnableLocalProfileMigration SwitchParameter
- Registers the machine-side local profile migrator. Use only on the endpoint whose profiles are being migrated.
- Intent string
- Execution intent. Use read_write for mutating execution.
- MachineTask AdMigrationMachineHandoffTaskKind
- Restricts execution to a single machine-side handoff task. Possible values: ComputerJoin, ProfileMigration
- Possible values:
ComputerJoin,ProfileMigration - TargetComputerName string
- Restricts machine-side handoff execution to one destination computer.
- WriteActorId string
- Actor identifier for audit correlation.
- WriteAuditCorrelationId string
- Audit correlation identifier.
- WriteChangeReason string
- Change reason or ticket for audit correlation.
- WriteExecutionId string
- Execution identifier for audit correlation.
- WriteRollbackPlanId string
- Rollback plan identifier for audit correlation.
- WriteRollbackProviderId string
- Rollback provider identifier for audit correlation.
Outputs
ADPlayground.Migrations.Core.AdMigrationPlanExecutionResult