This change adds additional logging for processes that are owned by either the migration user (the user being migrated) or the new local user (the resulting migrated user) when the tool detects a failure in migration.
This change also adds the optional ability to attempt to recover in these scenarios. If some process took hold of a user's registry during migration the tool will attempt to close this process before retrying the previous operation.
Is there anything particularly tricky?
How should this be tested?
I'm testing this in this general manner:
Identify a portion of code that's changed from main branch. The idea here is to look for code where Get-ProcessByOwner is being called in start-migration or Set-UserRegistryLoadState is called.
Create a write-host line in that section of code followed by a start-Sleep 10
When that start sleep line executes I'll attempt to lock a users NTUSER.DAT.BAK file locking the file will trigger the code to retry loading/ unloading (up to three times). To lock this file you can either launch a process that loads the file or open the key in regedit. Either way if the file is locked the Set-UserRegistryLoadState will fail after three attempts to load/unload the key and the attempts to close processes owned by the user being migrated.
Example of "throwing" the unload registry steps before moving complied *.DAT.BAK files around
Issues
What does this solve?
This change adds additional logging for processes that are owned by either the migration user (the user being migrated) or the new local user (the resulting migrated user) when the tool detects a failure in migration.
This change also adds the optional ability to attempt to recover in these scenarios. If some process took hold of a user's registry during migration the tool will attempt to close this process before retrying the previous operation.
Is there anything particularly tricky?
How should this be tested?
I'm testing this in this general manner:
main
branch. The idea here is to look for code whereGet-ProcessByOwner
is being called instart-migration
orSet-UserRegistryLoadState
is called.Set-UserRegistryLoadState
will fail after three attempts to load/unload the key and the attempts to close processes owned by the user being migrated.Example of "throwing" the unload registry steps before moving complied *.DAT.BAK files around
Screenshots