← Back to Tools Index

Compare Migration

Version: 1.0 Last Modified: February 18, 2026 Author: Doug Hesseltine

Audit file migration completeness by comparing file and folder counts between source and destination network shares.

What Does This Do?

This PowerShell script compares file and folder counts between two network share locations to verify migration completeness. It scans each top-level subfolder and generates an HTML report showing which folders match and which have discrepancies.

Safe to Run

This script only reads information. It does NOT copy, move, or modify any files.

Why Do I Need This?

Download

Get the Script

Download: compare-migration.ps1

Or download directly via PowerShell:

iwr https://technologist.services/tools/compare_migration/compare-migration.ps1 -OutFile compare-migration.ps1

Requirements

Quick Start Guide

Step 1: Download the Script

Save compare-migration.ps1 to a folder on your computer (e.g., C:\Scripts)

Step 2: Open PowerShell

Open PowerShell as Administrator and navigate to the script location:

cd C:\Scripts

Step 3: Run the Comparison

Execute the script with your source and destination servers/shares:

.\compare-migration.ps1 -Source "oldserver" -SourceShare "users" -Destination "newserver" -DestShare "users"

Step 4: Review the Report

The script automatically opens the HTML report in your default browser. The report is saved as:

migrationreport-{sharename}-{date}.html

Example: migrationreport-users-feb18_2026.html

TIP: Script Blocked by Execution Policy?

If PowerShell blocks the script, you can bypass the execution policy temporarily:

PowerShell.exe -ExecutionPolicy Bypass -File .\compare-migration.ps1 -Source "oldserver" -SourceShare "users" -Destination "newserver" -DestShare "users"

Parameters

-Source (Required)

The hostname or IP address of the source server.

Example: -Source "fileserver01"

-SourceShare (Required)

The name of the share on the source server.

Example: -SourceShare "users"

-Destination (Required)

The hostname or IP address of the destination server.

Example: -Destination "fileserver02"

-DestShare (Required)

The name of the share on the destination server.

Example: -DestShare "users"

-ReportPath (Optional)

Custom path for the HTML report. If not specified, defaults to script directory with auto-generated filename.

Example: -ReportPath "C:\Reports\migration-audit.html"

Full Example

.\compare-migration.ps1 `
    -Source "oldnas" `
    -SourceShare "departments" `
    -Destination "newnas" `
    -DestShare "departments" `
    -ReportPath "C:\Reports\dept-migration.html"

Key Features

Temporary File Exclusion

The script automatically excludes temporary files starting with ~ (like Office temp files) from all comparisons.

  • Files like ~$document.docx are ignored
  • If temp files are the only difference, folder shows as MATCH
  • Prevents false positives from locked Office documents
Missing File Identification

When fewer than 10 files are missing from a folder, the report lists the specific file paths.

  • Helps IT staff quickly locate and fix issues
  • Shows full path to each missing file
  • Only displayed for small differences to keep report readable
Dynamic Report Naming

Report filenames automatically include the destination share name and date for easy organization.

  • Format: migrationreport-{sharename}-{mmmdd_yyyy}.html
  • Example: migrationreport-users-feb18_2026.html
  • Run multiple audits without overwriting previous reports
Junction Point Handling

Automatically excludes NTFS junction points from scans to avoid infinite loops and duplicate counting.

  • Safe for user profile folders with junction points
  • Prevents scanning of redirected system folders

Understanding the Report

Report Columns

Status Colors

Note About Counts

The raw file counts shown may include temp files, but the MATCH/MISMATCH status is determined after excluding temp files. A folder may show different counts but still be marked as MATCH if the only differences are temporary files.

Common Problems

Cannot Access Network Share

Test connectivity:

Test-Path "\\servername\sharename"

Check your credentials have read access to both shares.

Script Shows All Zeros

This usually means robocopy couldn't access the folders. Check:

  • Network connectivity to both servers
  • Share permissions allow read access
  • NTFS permissions on the folders
Report Shows Mismatch But Files Look Correct

The script now excludes temp files (~*) automatically. If you still see mismatches:

  • Check for hidden or system files
  • Verify files aren't in use/locked on source
  • Look at the "Missing Files" column for specifics
Script Takes Very Long Time

Large folders with many files will take time to scan. The script shows progress:

[1/57] Scanning: username

Consider running during off-hours for large migrations.

← Back to Tools Index