Generalize the Windows VM using Sysprep, Using Sysprep command removes all your personal account & security information, and then prepares the machine to be used as an image.
Please make sure the server roles running on the machine are supported by Sysprep
Important Note:
After you run the Sysprep on a Virtual Machine that VM is considered generalized & cannot be restarted. The process of generalizing the windows Virtual Machine is not reversible.
Generalize the Windows VM using Sysprep
For more details visit Microsoft
To generalize the Windows Virtual Machine, follow the below steps:
1- Sign in to your Windows VM.

2- Open the Run command by pressing Windows key+R button. Change the directory to %windir%system32sysprep and then hit Ok.

3- Double-click on the sysprep.exe file to run the setup.

4- In the System Preparation Tool Wizard dialog box, choose Enter System Out-of-Box Experience (OOBE) under system cleanup action and then select the Generalize checkbox.
Under Shutdown Options, select Shutdown and then select OK.

5- Processing generalize phase Sysprep plugin.

When Sysprep completes, it will shut down the Virtual Machine. Please do not restart the VM.