If running out of disk space on the VM
Run disk cleanup. It is normally down to the Windows error reporting files and C:\Windows\Temp folder being very full. Delete the former and empty the latter respectively. The former should be turned off via Group Policy and cleared on a weekly basis by a “Windows disk cleanup” scheduled task. The latter can be cleared by a batch file which runs on startup.
If running out of disk space on the Hyper-V server
Set an alert through File Resource Manager alerts if the disk space falls below a certain % on the appropriate drive. Determine what the cause is. Follow the below if the cause of the VDIs.
1. Ensure system restore is turned off in the VMs.
2. Use the free partition tool EaseUS Partition Master free edition to shrink the virtual drive of the VM from within the VMs.
3. Shrink and compact vhdx from Hyper-V’s settings for the VDIs’ hard drives.
4. Increase vhdx size.
5. Boot the VDIs and increase the recognised disk allocation through disk management.
6. Remove the partition program.
9. Create a batch file to delete contents of c:\windows\temp as part of the master image. Ensure it is set to run at administrator login – in the startup folder. Run the batch file.
10. Ensure Windows Disk cleanup and disk defrag set to run automatically every week with the highest privileges regardless of whether the user is logged on: http://www.thewindowsclub.com/automate-disk-cleanup-utility-windows . Run the former.
11. Final restart of the VDIs.