How to Automate Profile Migrations with Scripts

How to Automate Profile Migrations with Scripts

The Case for Automation

Manual profile migrations are time-consuming and error-prone. When you are dealing with more than a handful of workstations, clicking through the ProfWiz GUI on each machine is impractical. ProfWiz's robust command-line interface (CLI) was designed precisely for this β€” it exposes every migration capability as a parameter so you can wrap it in batch files, PowerShell scripts, SCCM task sequences, or Ansible playbooks.

ProfWiz Command-Line Reference

How to Automate Profile Migrations with Scripts illustration

The core ProfWiz executable (ProfWiz.exe) accepts the following key parameters:

  • /domain:DOMAINNAME β€” the target Active Directory domain
  • /user:username β€” the target domain username
  • /MigrateLocalProfile β€” migrates the local profile to the domain account
  • /Silent β€” suppresses all GUI dialogs (required for unattended operation)
  • /Log:C:\path o\logfile.log β€” writes a detailed migration log
  • /ProfileDir:C:\custom\path β€” use when the profile is in a non-default location
  • /Reboot β€” automatically reboots after a successful migration
  • /NoReboot β€” suppresses the reboot prompt

Batch Script: Single Machine Migration

The simplest automation is a batch file placed on the workstation:

@echo off
echo Starting profile migration...
ProfWiz.exe /domain:CONTOSO /user:%1 /MigrateLocalProfile /Silent /Log:C:\Windows\Temp\profwiz.log /Reboot
echo Migration initiated. Check log at C:\Windows\Temp\profwiz.log

Call this with: migrate.bat johndoe where johndoe is the domain username.

PowerShell Script: Bulk Migration from CSV

For fleet-wide migrations, maintain a CSV mapping file:

# mapping.csv
LocalUser,DomainUser,ComputerName
jsmith,john.smith,DESKTOP-001
mmiller,mary.miller,LAPTOP-042

Then use this PowerShell script to drive ProfWiz remotely:

 = Import-Csv "\fileserver\migration\mapping.csv"
 = "\fileserver	ools\ProfWiz.exe"
 = "\fileserver\migration-logs"

foreach ( in ) {
     = .ComputerName
     = .DomainUser

    Write-Host "Processing  -> "

    Invoke-Command -ComputerName  -ScriptBlock {
        param(, , )
        Start-Process -FilePath  `
            -ArgumentList "/domain:CONTOSO /user: /MigrateLocalProfile /Silent /Log: /NoReboot" `
            -Verb RunAs -Wait
    } -ArgumentList , , "$computer.log"
}

This script loops through every row in the CSV, connects to the remote machine via PowerShell remoting, and executes ProfWiz silently. Logs are written to a central share for easy review.

SCCM Task Sequence Integration

If your environment uses Microsoft Endpoint Configuration Manager (SCCM / MECM), ProfWiz integrates cleanly as a task sequence step:

  1. Add ProfWiz.exe and your mapping CSV to an SCCM package
  2. Create a new task sequence and add a Run Command Line step
  3. Command: ProfWiz.exe /domain:CONTOSO /user:%NewDomainUser% /MigrateLocalProfile /Silent /Log:%_SMSTSLogPath%\profwiz.log
  4. Set the task variable NewDomainUser using a preceding script that queries your mapping database
  5. Deploy the task sequence to the target collection

Group Policy Startup Script

For environments without SCCM, a Group Policy startup script achieves similar results:

  1. Place ProfWiz.exe and the migration batch file in SYSVOL
  2. Create a GPO linked to the OU containing the workstations to be migrated
  3. Under Computer Configuration > Windows Settings > Scripts > Startup, add the batch file
  4. The script runs at machine startup with SYSTEM privileges β€” sufficient for ProfWiz
  5. Disable the GPO link after migration is complete to prevent re-running

Error Handling in Scripts

ProfWiz returns exit codes that scripts can check:

  • 0 β€” success
  • 1 β€” migration failed (check log for details)
  • 2 β€” profile not found
  • 3 β€” domain account not found

In PowerShell, capture and act on the exit code:

if ( -eq 0) {
    Write-Host "Migration succeeded on "
} else {
    Write-Warning "Migration failed on  (exit code )"
}

Testing Before Production

Always test your automation scripts in a lab environment with virtual machines before running against production workstations. Validate that the CSV mapping is correct, the script reaches the target machines, and the log files are created and populated.

Conclusion

Automating profile migrations with ProfWiz scripts transforms a week of manual work into an overnight operation that runs without administrator intervention. Whether you use batch files, PowerShell, SCCM, or Group Policy, ProfWiz's CLI gives you the control you need to migrate hundreds of profiles reliably and consistently.