-
-
Save gowatana/8446e8ef5ecd3b29c9a2051d997b5e88 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usage: 02_delete_vcd_vapp.ps1 config.ps1 | |
# Author: @gowatana | |
$config_ps1_file = $args[0] | |
if($args.Count -ne 1){"Config .ps1 NOT found."; exit 1} | |
Get-ChildItem -ErrorAction:Ignore $config_ps1_file | Out-Null | |
if($? -eq $false){"Config $config_ps1_file NOT found."; exit 1} | |
. $config_ps1_file | |
$vapp_name_list = $vapp_number_start..$vapp_number_end | % { | |
$vapp_number_strings = $_.ToString("000") | |
$vapp_name = $vapp_name_prefix + "-" + $vapp_number_strings | |
$vapp_name | |
} | |
$vapp_name_list | % { | |
$vapp_name = $_ | |
Write-Host "Stop vApp: $vapp_name" | |
Get-CIVApp $vapp_name | Where {$_.Status -ne "PoweredOff"} | Stop-CIVApp -Confirm:$false | Out-Null | |
Write-Host "Delete vApp: $vapp_name" | |
Get-CIVApp $vapp_name | Remove-CIVApp -Confirm:$false -RunAsync | Out-Null | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
下記の投稿むけ。
VMware Cloud Director 10.4 を PowerCLI で操作してみる。Part-05 vApp クローン スクリプトの例
https://vm.gowatana.jp/entry/2023/04/30/235923