Add upstream changes in cleanup step
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@ -16,7 +16,7 @@ $PowerCliConfigurationSplat = @{
|
||||
Confirm = $False
|
||||
InvalidCertificateAction = 'Ignore'
|
||||
}
|
||||
Set-PowerCLIConfiguration @PowerCliConfigurationSplat
|
||||
Set-PowerCLIConfiguration @PowerCliConfigurationSplat | Out-Null
|
||||
|
||||
$ConnectVIServerSplat = @{
|
||||
Server = $VSphereFQDN
|
||||
@ -26,14 +26,26 @@ $ConnectVIServerSplat = @{
|
||||
}
|
||||
Connect-VIServer @ConnectVIServerSplat | Out-Null
|
||||
|
||||
$RemoveVMSplat = @{
|
||||
VM = "$($VMName)*"
|
||||
DeletePermanently = $True
|
||||
Confirm = $False
|
||||
ErrorAction = 'SilentlyContinue'
|
||||
$GetVMSplat = @{
|
||||
Name = "*$($VMName)*"
|
||||
ErrorAction = 'SilentlyContinue'
|
||||
}
|
||||
If ([boolean](Get-VM @GetVMSplat)) {
|
||||
$RemoveVMSplat = @{
|
||||
VM = Get-VM @GetVMSplat
|
||||
DeletePermanently = $True
|
||||
Confirm = $False
|
||||
ErrorAction = 'SilentlyContinue'
|
||||
}
|
||||
Remove-VM @RemoveVMSplat
|
||||
}
|
||||
Remove-VM @RemoveVMSplat
|
||||
|
||||
# Also delete ISO/floppy?
|
||||
Disconnect-VIServer * -Confirm:$False
|
||||
|
||||
Disconnect-VIServer * -Confirm:$False
|
||||
$RemoveItemSplat = @{
|
||||
Path = "/scratch/*"
|
||||
Recurse = $True
|
||||
Force = $True
|
||||
Confirm = $False
|
||||
}
|
||||
Remove-Item @RemoveItemSplat
|
Reference in New Issue
Block a user