Dear visitor, in case we do not cover a topic you are looking for, then feel free to ask in our freshly created forum for IT-professionals for a solution. We hope our visitors can help you out with your questions. Have a good one. ~ Tom.

How to migrate local users / groups from Microsoft Windows Server 2016 to 2019/2022

Migrate local users

I came across the need to migrate local users and groups from Microsoft Windows Server 2016 to Microsoft Windows Server 2019/2022.

  1. Install Windows Server Migration Tool, on the source Windows Server 2016 and the target Windows Server 2019/2022. Start Powershell as administrator and run following commands:
    PS C:\Users\Administrator> Import-Module ServerManager
    PS C:\Users\Administrator> Add-WindowsFeature Migration
    Success Restart Needed Exit Code      Feature Result
    ------- -------------- ---------      --------------
    True    No             Success        {Windows Server Migration Tools}
  2. Share a folder on the target Windows Server 2019/2022 (for example \\192.168.0.1\UsrMigration)
  3. On the source Windows Server 2016 use the following command to export the local users and groups to the previously created share on the target server (make sure you have authenticated against the share).
    PS C:\Users\Administrator> cd C:\Windows\System32\ServerMigrationTools\
    PS C:\Windows\System32\ServerMigrationTools> .\SmigDeploy.exe /package /architecture amd64 /os WS16 /path \\192.168.0.1\UsrMigration
    SmigDeploy.exe is checking for prerequisites.
    --------------------------------------------------------------------------------
    SmigDeploy.exe is copying Windows Server Migration Tools files to \\192.168.0.1\UsrMigration\SMT_ws16_amd64.
    --------------------------------------------------------------------------------
    PS C:\Windows\system32\ServerMigrationTools> Add-PSSnapin Microsoft.Windows.ServerManager.Migration
    PS C:\Windows\system32\ServerMigrationTools> Export-SmigServerSetting -User All -Group -Path \\192.168.0.1\UsrMigration -Verbose
    
    cmdlet Export-SmigServerSetting at command pipeline position 1
    Supply values for the following parameters:
    Password: *******************
    
    ItemType ID Success DetailsList
    -------- -- ------- -----------
    OSSetting Local User True {}
    OSSetting Local Group True {}
    
    PS C:\Windows\system32\ServerMigrationTools> echo MyPassword  > \\192.168.0.1\UsrMigration\Password.txt
    
  4. Verify the presence of the created files on the previously created share.
    PS C:\Windows\System32\ServerMigrationTools> dir \\192.168.0.1\UsrMigration\SMT_ws16_amd64\
    
        Directory: \\10.0.1.31\UsrMigration\SMT_ws16_amd64
    
    Mode                LastWriteTime         Length Name
    ----                -------------         ------ ----
    d-----       03.09.2021     22:46                en
    d-----       03.09.2021     22:47                replacementmanifests
    -a----       08.01.2021     00:24         175880 cmi2migxml.dll
    -a----       08.01.2021     00:26         662280 csiagent.dll
    -a----       03.09.2021     22:37        8417280 Microsoft.Windows.ServerManager.Migration.dll
    -a----       08.01.2021     00:24        8291080 migcore.dll
    -a----       08.01.2021     00:20         270736 mighost.exe
    -a----       16.07.2016     15:19          16224 migres.dll
    -a----       08.01.2021     00:24        1188104 migstore.dll
    -a----       08.01.2021     00:25         312592 MXEAgent.dll
    -a----       16.07.2016     15:19            228 ServerMigration.psc1
    -a----       16.07.2016     15:19           1824 SFCN.dat
    -a----       16.07.2016     15:19           1644 SFLCID.dat
    -a----       16.07.2016     15:19        3348038 SFLISTLH.dat
    -a----       16.07.2016     15:19        5590872 SFLISTRS1.dat
    -a----       16.07.2016     15:19        1703322 SFLISTW7.dat
    -a----       16.07.2016     15:19        2608968 SFLISTW8.dat
    -a----       16.07.2016     15:19        3173014 SFLISTWB.dat
    -a----       16.07.2016     15:19        4935856 SFLISTWT.dat
    -a----       16.07.2016     15:19        1459266 SFLISTXP.dat
    -a----       16.07.2016     15:19          11345 SFPAT.inf
    -a----       16.07.2016     15:19           8678 SFPATLH.inf
    -a----       16.07.2016     15:19         169643 SFPATRS1.inf
    -a----       16.07.2016     15:19          17117 SFPATW7.inf
    -a----       16.07.2016     15:19          79539 SFPATW8.inf
    -a----       16.07.2016     15:19          91356 SFPATWB.inf
    -a----       16.07.2016     15:19         165630 SFPATWT.inf
    -a----       16.07.2016     15:19           4355 SFPATXP.inf
    -a----       03.09.2021     22:37          81920 SmigDeploy.exe
    -a----       03.09.2021     22:37         719360 svrmig.dll
    -a----       25.10.2018     06:02        1098176 unbcl.dll
    -a----       03.09.2021     22:37         249696 wdscore.dll
  5. On the destination Windows Server 2019/2022 open the Windows Server Migration Tool. Start Powershell as administrator and run following commands.
    cmd.exe
    %windir%\system32\WindowsPowershell\v1.0\powershell.exe -psconsolefile %windir%\system32\ServerMigrationTools\ServerMigration.psc1
    PS C:\Users\Administrator> cd C:\Windows\System32\PS C:\Windows\System32> Import-SmigServerSetting -User Enabled -Group -Path \\192.168.0.1\UsrMigration -Verbose
  6. After the files has been imported, check the presence of the users and verify the SID of the objects.

    Source:

    PS C:\Windows\System32> wmic useraccount get name,sid
    Name SID
    XXXXXXXXXX S-1-5-21-4115556112-3171488497-xxxxxxxxx-500
    XXXXXXXXXX S-1-5-21-4115556112-3171488497-xxxxxxxxx-1002
    XXXXXXXXXX S-1-5-21-4115556112-3171488497-xxxxxxxxx-1003
    XXXXXXXXXX S-1-5-21-4115556112-3171488497-xxxxxxxxx-1005
    XXXXXXXXXX S-1-5-21-4115556112-3171488497-xxxxxxxxx-1006
    XXXXXXXXXX S-1-5-21-4115556112-3171488497-xxxxxxxxx-1007
    XXXXXXXXXX S-1-5-21-4115556112-3171488497-xxxxxxxxx-1008
    XXXXXXXXXX S-1-5-21-4115556112-3171488497-xxxxxxxxx-503
    XXXXXXXXXX S-1-5-21-4115556112-3171488497-xxxxxxxxx-501
    XXXXXXXXXX S-1-5-21-4115556112-3171488497-xxxxxxxxx-1009
    XXXXXXXXXX S-1-5-21-4115556112-3171488497-xxxxxxxxx-1055
    XXXXXXXXXX S-1-5-21-4115556112-3171488497-xxxxxxxxx-1010
    XXXXXXXXXX S-1-5-21-4115556112-3171488497-xxxxxxxxx-1054
    XXXXXXXXXX S-1-5-21-4115556112-3171488497-xxxxxxxxx-1044
    XXXXXXXXXX S-1-5-21-4115556112-3171488497-xxxxxxxxx-1056
    XXXXXXXXXX S-1-5-21-4115556112-3171488497-xxxxxxxxx-1001
    XXXXXXXXXX S-1-5-21-4115556112-3171488497-xxxxxxxxx-1000
    

    Target:

    PS C:\Windows\System32> wmic useraccount get name,sid
    Name SID
    XXXXXXXXXX S-1-5-21-4115556112-3171488497-xxxxxxxxx-500
    XXXXXXXXXX S-1-5-21-4115556112-3171488497-xxxxxxxxx-1002
    XXXXXXXXXX S-1-5-21-4115556112-3171488497-xxxxxxxxx-1003
    XXXXXXXXXX S-1-5-21-4115556112-3171488497-xxxxxxxxx-1005
    XXXXXXXXXX S-1-5-21-4115556112-3171488497-xxxxxxxxx-1006
    XXXXXXXXXX S-1-5-21-4115556112-3171488497-xxxxxxxxx-1007
    XXXXXXXXXX S-1-5-21-4115556112-3171488497-xxxxxxxxx-1008
    XXXXXXXXXX S-1-5-21-4115556112-3171488497-xxxxxxxxx-503
    XXXXXXXXXX S-1-5-21-4115556112-3171488497-xxxxxxxxx-501
    XXXXXXXXXX S-1-5-21-4115556112-3171488497-xxxxxxxxx-1009
    XXXXXXXXXX S-1-5-21-4115556112-3171488497-xxxxxxxxx-1055
    XXXXXXXXXX S-1-5-21-4115556112-3171488497-xxxxxxxxx-1010
    XXXXXXXXXX S-1-5-21-4115556112-3171488497-xxxxxxxxx-1054
    XXXXXXXXXX S-1-5-21-4115556112-3171488497-xxxxxxxxx-1044
    XXXXXXXXXX S-1-5-21-4115556112-3171488497-xxxxxxxxx-1056
    XXXXXXXXXX S-1-5-21-4115556112-3171488497-xxxxxxxxx-1001
    XXXXXXXXXX S-1-5-21-4115556112-3171488497-xxxxxxxxx-1000

Note: After the users was imported on the target server, those accounts are locked and have the attribute set to change the password after the first login – remove those attributes on the user objects if required.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.