Delete commit history (containing proprietary code)
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:
39
scripts/Remove-Resources.ps1
Normal file
39
scripts/Remove-Resources.ps1
Normal file
@ -0,0 +1,39 @@
|
||||
[CmdletBinding()]
|
||||
Param(
|
||||
[Parameter(Mandatory)]
|
||||
[string]$VMName,
|
||||
[Parameter(Mandatory)]
|
||||
[string]$VSphereFQDN,
|
||||
[Parameter(Mandatory)]
|
||||
[string]$VSphereUsername,
|
||||
[Parameter(Mandatory)]
|
||||
[string]$VSpherePassword
|
||||
)
|
||||
|
||||
$PowerCliConfigurationSplat = @{
|
||||
Scope = 'User'
|
||||
ParticipateInCEIP = $False
|
||||
Confirm = $False
|
||||
InvalidCertificateAction = 'Ignore'
|
||||
}
|
||||
Set-PowerCLIConfiguration @PowerCliConfigurationSplat | Out-Null
|
||||
|
||||
$ConnectVIServerSplat = @{
|
||||
Server = $VSphereFQDN
|
||||
User = "$VSphereUsername"
|
||||
Password = "$VSpherePassword"
|
||||
WarningAction = 'SilentlyContinue'
|
||||
}
|
||||
Connect-VIServer @ConnectVIServerSplat | Out-Null
|
||||
|
||||
$RemoveVMSplat = @{
|
||||
VM = "$($VMName)*"
|
||||
DeletePermanently = $True
|
||||
Confirm = $False
|
||||
ErrorAction = 'SilentlyContinue'
|
||||
}
|
||||
Remove-VM @RemoveVMSplat
|
||||
|
||||
# Also delete ISO/floppy?
|
||||
|
||||
Disconnect-VIServer * -Confirm:$False
|
Reference in New Issue
Block a user