Below is a proven, “copy–paste–tweak” recipe that will let you
• capture only the real C:\Users\piot profile,
• ignore every file / folder that lives on, or is redirected to, the D: drive (even when the profile contains junctions / symbolic links that point there),
• reinstall Windows 11,
• bring “piot” back – minus the D: stuff.
────────────────────────────────────────
- Install the proper USMT version
────────────────────────────────────────
• Download and install the Windows ADK that matches the Windows 11 build you are deploying (22H2, 23H2, …).
During setup tick only
‑ “Deployment Tools” ⇒ that gives you USMT (ScanState / LoadState).
Assume USMT ends up in
C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\User State Migration Tool\amd64
Add that path to %PATH% or use the full path in every command.
────────────────────────────────────────
2. Build a tiny “Exclude-D” migration XML
────────────────────────────────────────
Create a file called Exclude-D.xml and put it next to MigDocs.xml & MigApp.xml, e.g.:
<?xml version="1.0"?>
<migration urlid="http://contoso.com/usmt/ExcludeDDrive">
<!-- Exclude *anything* that sits on drive D: -->
<component type="Documents" context="User">
<displayName>Exclude D drive data</displayName>
<role role="Data">
<rules>
<exclude>
<objectSet>
<!-- The real line that does the trick -->
<pattern type="File">D:\*.*</pattern>
</objectSet>
</exclude>
</rules>
</role>
</component>
</migration>
Why it works
• USMT processes XML files from left to right.
• Any later “include” overrides an earlier “exclude”, so put Exclude-D after MigDocs/MigApp (they do the big include), and the D:\ rule will win.
────────────────────────────────────────
3. Capture the profile
────────────────────────────────────────
Open an elevated prompt and run:
REM ► Where the store will be written
set MSTORE=\\Fileserver\USMTStores\piot
REM ► Run ScanState
scanstate %MSTORE% ^
/i:MigApp.xml /i:MigDocs.xml /i:Exclude-D.xml ^
/ue:* /ui:%COMPUTERNAME%\piot ^
/o /c /v:13 ^
/localonly REM = no remote profiles
Explanation of the key switches
/ue:* – exclude every user
/ui:piot – …except piot
/o – overwrite a previous store, if it exists
/c – ignore non-fatal errors (keeps the run going)
/v:13 – verbose logging
/localonly – in case the machine is domain-joined, you still take only the local profile
Result: a compressed .MIG store that contains the profile without any D:\ data.
The directory junctions/symlinks themselves do get copied, but their targets are ignored.
────────────────────────────────────────
4. Re-install / re-image Windows 11
────────────────────────────────────────
Don’t log on as “piot” yet. If you already did, no panic – just delete the newly-created
C:\Users\piot folder (or rename it) before the restore.
────────────────────────────────────────
5. Restore the profile
────────────────────────────────────────
loadstate %MSTORE% ^
/i:MigApp.xml /i:MigDocs.xml /i:Exclude-D.xml ^
/ue:* /ui:%COMPUTERNAME%\piot ^
/c /v:13 ^
/lac /lae REM Create the account if it does not exist, enable it
After LoadState finishes, sign in as “piot”.
Everything that was in C:\Users\piot is back, the links that pointed to D:\ are still present but the actual D: data never got touched. If D: still exists in the new install, the links continue to work; if not, they simply point nowhere (exactly what you wanted).
────────────────────────────────────────
6. (Optional) Verify what gets migrated before you pull the trigger
────────────────────────────────────────
USMT can do a “pre-flight” listing so you see today whether something on D: would slip through:
scanstate C:\Temp\DummyStore /p /i:MigApp.xml /i:MigDocs.xml /i:Exclude-D.xml /ue:* /ui:%COMPUTERNAME%\piot /v:13 /c
type C:\Temp\ScanState.txt REM ➜ shows every file that would be captured
Because of the /p (estimate-only) switch, nothing is actually written; you just get the file list.
────────────────────────────────────────
Frequently-asked questions
────────────────────────────────────────
Q 1. “But the profile has ‘hard links’ to D:. NTFS hard-links can’t span volumes, can they?”
A 1. Correct – cross-volume “links” are either directory junctions or symbolic links, not hard links. USMT treats all three as reparse points. By default it copies the link itself, then (optionally) follows it and copies the target. Our Exclude-D rule blocks the latter.
Q 2. “Could I simply tell USMT ‘don’t follow any reparse points’?”
A 2. Yes. Add the global switch /norecurse (deprecated) or explicitly exclude reparse-point types in XML. The XML approach shown above is more granular and future-proof.
Q 3. “I need to exclude just one or two folders on D:, not the whole drive.”
A 3. Replace the pattern with, e.g.
D:\Movies*.*
You can have as many lines as you like.
Q 4. “The new PC has no D: drive, will piot get errors?”
A 4. The junctions/symlinks will be restored pointing to “D:\…”. Windows will not crash; the user will simply get a ‘location unavailable’ message when opening a link. You can recreate D: (even as a folder mounted volume) or remove the links post-migration.
────────────────────────────────────────
That’s it – a clean USMT migration of the “piot” profile, minus everything that lives on D:.
Happy deployments! 🎉