MSLab
MSLab copied to clipboard
Add try catch for stale / mounted WindowsImages
In some cases deploy.ps1 or other scripts may fail because of an incorrectly mounted / dismounted or stale image.
This could be achieved before mounting a new image with Mount-WindowsImage, to check the condition
get-windowsimage -mounted is not $null
then execute
dism /cleanup-mountpoints