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
|
Confirm = $False
|
||||||
InvalidCertificateAction = 'Ignore'
|
InvalidCertificateAction = 'Ignore'
|
||||||
}
|
}
|
||||||
Set-PowerCLIConfiguration @PowerCliConfigurationSplat
|
Set-PowerCLIConfiguration @PowerCliConfigurationSplat | Out-Null
|
||||||
|
|
||||||
$ConnectVIServerSplat = @{
|
$ConnectVIServerSplat = @{
|
||||||
Server = $VSphereFQDN
|
Server = $VSphereFQDN
|
||||||
@@ -26,14 +26,26 @@ $ConnectVIServerSplat = @{
|
|||||||
}
|
}
|
||||||
Connect-VIServer @ConnectVIServerSplat | Out-Null
|
Connect-VIServer @ConnectVIServerSplat | Out-Null
|
||||||
|
|
||||||
$RemoveVMSplat = @{
|
$GetVMSplat = @{
|
||||||
VM = "$($VMName)*"
|
Name = "*$($VMName)*"
|
||||||
DeletePermanently = $True
|
ErrorAction = 'SilentlyContinue'
|
||||||
Confirm = $False
|
}
|
||||||
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