Fix path;Add conditional
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2021-02-13 20:16:31 +01:00
parent 2790b9c9d9
commit 961624998b
2 changed files with 17 additions and 11 deletions

View File

@ -26,14 +26,20 @@ $ConnectVIServerSplat = @{
}
Connect-VIServer @ConnectVIServerSplat | Out-Null
$RemoveVMSplat = @{
VM = "$($VMName)*"
DeletePermanently = $True
Confirm = $False
ErrorAction = 'SilentlyContinue'
$GetVMSplat = @{
VM = "$($VMName)*"
ErrorAction = 'SilentlyContinue'
}
If ([boolean](Get-VM @GetVMSplat)) {
$RemoveVMSplat = @{
VM = "$($VMName)*"
DeletePermanently = $True
Confirm = $False
ErrorAction = 'SilentlyContinue'
}
Remove-VM @RemoveVMSplat
}
Remove-VM @RemoveVMSplat
# Also delete ISO/floppy?
Disconnect-VIServer * -Confirm:$False
Disconnect-VIServer * -Confirm:$False
# Delete scratch folder contents