TestimoX

API Reference

Command

Invoke-ADXMigrationPlan

Namespace ADPlayground.PowerShell
Inputs
ADPlayground.Migrations.Core.AdMigrationPlan
Outputs
ADPlayground.Migrations.Core.AdMigrationPlanExecutionResult

Executes or previews an AD migration plan.

Examples

Authored help example

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 requiredposition: namedpipeline: true (ByValue)
Migration plan to execute or preview.
AllowWrite SwitchParameter optionalposition: namedpipeline: falsealiases: allow_write
Explicitly allows write execution when combined with Apply and read_write intent.
Apply SwitchParameter optionalposition: namedpipeline: false
Applies supported mutating phases.
ArtifactDirectory string optionalposition: namedpipeline: false
Directory for execution artifacts such as offline-domain-join blobs.
CredentialSecret Hashtable optionalposition: namedpipeline: false
Runtime credential secrets keyed by credential secret reference. The plan stores references only; execution receives the secret values.
DryRun SwitchParameter optionalposition: namedpipeline: falsealiases: dry_run
Runs the plan without applying changes.
EnableLocalComputerJoin SwitchParameter optionalposition: namedpipeline: false
Allows an offline-domain-join artifact to be applied to the local computer. Use only on the destination endpoint.
EnableLocalProfileMigration SwitchParameter optionalposition: namedpipeline: false
Registers the machine-side local profile migrator. Use only on the endpoint whose profiles are being migrated.
Intent string optionalposition: namedpipeline: false
Execution intent. Use read_write for mutating execution.
MachineTask AdMigrationMachineHandoffTaskKind optionalposition: namedpipeline: falsevalues: 2
Restricts execution to a single machine-side handoff task. Possible values: ComputerJoin, ProfileMigration
Possible values: ComputerJoin, ProfileMigration
TargetComputerName string optionalposition: namedpipeline: false
Restricts machine-side handoff execution to one destination computer.
WriteActorId string optionalposition: namedpipeline: falsealiases: write_actor_id
Actor identifier for audit correlation.
WriteAuditCorrelationId string optionalposition: namedpipeline: falsealiases: write_audit_correlation_id
Audit correlation identifier.
WriteChangeReason string optionalposition: namedpipeline: falsealiases: write_change_reason
Change reason or ticket for audit correlation.
WriteExecutionId string optionalposition: namedpipeline: falsealiases: write_execution_id
Execution identifier for audit correlation.
WriteRollbackPlanId string optionalposition: namedpipeline: falsealiases: write_rollback_plan_id
Rollback plan identifier for audit correlation.
WriteRollbackProviderId string optionalposition: namedpipeline: falsealiases: write_rollback_provider_id
Rollback provider identifier for audit correlation.

Outputs

ADPlayground.Migrations.Core.AdMigrationPlanExecutionResult