Isn’t it awesome when you need something, know it will eventually arrive, but need it now anyways? That’s a bit of what the information in the post is all about, but here goes anyhow.
First the apology =) Unfortunately I wrote way too many cmdlets recently for vCD, so I really don’t have enough chapters or cycles to get into the details around each cmdlet. I tried to include examples and descriptions for the cmdlets, but didn’t quite make it through all of them. It should be very self explanatory when looking at the name and the run-time example.
The goal of the cmdlets was to build the framework necessary to complete a whole bunch of automation with vCD, satisfying a primary use case for labs (actual lab cmdlets not here).
There is a lot of pretty cool stuff in here, some of the highlights are as follows.
Network
There are a handful of network related cmdlets. An important one for any VApp deployment is to be able to specify the External Network correctly (Update-CIVAppParentNetwork). In addition when a VApp is deployed you probably want to see the accessible remote IP (Get-CIRouterInfo). A new twist on the VApp networking has to do with the fencing that can take place. There is a cmdlet to view the fencing information (Get-CIFencing) for CIVMs to show their inside and outside mac addresses. Another useful one is (Get-CIVAppNetworkingFirewallRules) which displays the firewall rules associated to a VApp.
Disk
One of the great things about vCD is the use of thin and linked clones (fast provisioning). However, the reporting on a per object basis isn’t quite there. For this we leverage the Get-CIVCVM to cross-link the CIVMs to their respective VC VM’s to get details per virtual disk (Get-CIVAppDiskGroupings, Get-CIVAppDiskUsage). This is all fine and great, but I wanted to take a step even further than this and describe the relationship among VMs in the fast provisioning world (Get-CIVMDiskFileChain,Get-CIVMDiskFiles). These commands will list out the relevant virtual disks and show the amount of VM’s sharing those virtual disks and the chain length.
VApp/VAppTemplates and Catalogs
Note that due to the complexity of deployment the Instantiate-VApp cmdlet has been changed. In a previous post I demonstrated how you might be able to specify all of the relevant details (NAT, Firewall, etc) on the fly. This however is a bit tough to get going correctly and for most not necessary. So instead I opted to go for the “Clone” route which takes an existing configuration contained in a VAppTemplate and duplicates as much of it as possible versus specifying these things manually. I have also included another goodie (DeployLab-FromOrgCatalogToAnotherOrgCatalog) which demonstrates the VC to VC scalability of vCD without using the OVF export routine (future post to explain). Another good one is the ability to add VApps to catalogs and duplicate VAppTemplates among catalogs (Add-CIVAppTemplateToCatalog). Last but not least, in order to leverage VC to VC transfers correctly we have included the ability to consolidate VAppTemplates in the catalog (Consolidate-CIVAppTemplate). A new concept for vCD are shadow VMs. These are used to track back to original VApp Templates and can be difficult to track down at times so there is a cmdlet for this as well (Get-CIVMShadow).
WARNING: The VApp/VAppTemplate cmdlets allow you to do things that might bring you outside of your “workspace” which could cause OVF related activities (not good for most cases, lose VM identities, etc). Watch VC to see what is happening during these processes to ensure this is not the case.
VC Related
When running large scale environments there are always key things that need to be aligned. I created a couple of easy ones (Get-VMHostDateTime and Get-VMHostSoftwareList) to help out with ensuring the hosts are aligned from a time perspective, and verifying all hosts were running the same vcloud agent version. You will notice that there are a handful of cmdlets that leverage a VC connection (Connect-VIServer) in order to work correctly. These are where I lookup the underlying VI information for an object to give a more complete view of something. These hybrid views have turned out to be very powerful.
Anyways, have fun with the 43 cmdlets! The following is unsupported and probably soon to be replaced =)
- Install PowerCLI 5.0.1, with Cloud
- Download the Cmdlet module here.
- Import-Module .\custom_vcd_cmdlets.psm1
- Connect-CIServer
- Connect-VIServer on some cmdlets
Remove-Catalog
Get-Catalog -name Catalog01 -org myOrg | Remove-Catalog -Confirm:$False
New-Catalog
New-Catalog -name Catalog01 -Org myOrg -isPublished:$true
Remove-CICustomProperties
Get-CIVApp Google* | Get-CIVM name | Remove-CICustomProperties
Get-CIDatastore
Get-ProviderVdc Google* | Get-CIDatastore
Get-CIMetadata
Get-CIVApp Google* | Get-CIMetadata
New-CIMetadata
Get-CIVApp Google* | Set-CIMetadata -key "test" -value "testvalue"
Remove-CIMetadata
Get-CIVApp Google* | where{$_.key -eq "test"} | Remove-CIMetadata
Update-CIMetadata
Get-CIVApp Google* | where{$_.key -eq "test"} | Update-CIMetadata -value "updated"
Get-CIRouterInfo
Get-CIVApp Google* | Get-CIRouterInfo
Update-CIUser
Get-CIUser labsorg | Update-CIUser -description 1
Remove-CIVApp
Get-Org Labs | Get-CIVApp Base-ePod-Basic-v8 | Remove-CIVApp
Start-CIVApp
Get-CIVApp Google* | Start-CIVApp
Get-CIVAppDiskGroupings
Get-CIVApp VApptest* | Get-CIVAppDiskGroupings
Get-CIVAppDiskUsage
Get-CIVApp test* | Get-CIVAppDiskUsage
Update-CIVAppParentNetwork
Get-CIVApp Google* | Update-CIVAppParentNetwork -parentnetwork (Get-Org (Get-OrgVdc ovdc_labs_c03).org | Get-OrgNetwork orgnetwork_external01_c03)
Get-CIVAppResourceUsage
Get-CIVApp test* | Get-CIVAppResourceUsage
Consolidate-CIVAppTemplate
Get-CIVAppTemplate Base-ePod-Basic-v8 -Catalog (Get-Org HOLDEV | Get-Catalog HOL_BASE_CAT01) | Consolidate-CIVAppTemplate
Remove-CIVAppTemplate
Get-CIVAppTemplate Base-ePod-Basic-v8 -Catalog (Get-Org HOLDEV | Get-Catalog HOL_BASE_CAT01) | Remove-CIVAppTemplate
Update-CIUser
Get-CIUser labsorg | Update-CIUser -description 1
Get-CIVAppTemplateDiskUsage
Get-CIVAppTemplate test* | Get-CIVAppTemplateDiskUsage
Get-CIVAppTemplateResourceUsage
Get-CIVAppTemplate test* | Get-CIVAppTemplateResourceUsage
Add-CIVAppTemplateToCatalog
Get-CIVAppTemplate Google* | Add-CIVAppTemplateToCatalog -VAppTemplateName test1 -Catalog (Get-Org labs | Get-Catalog test) -ToOrgVdc (Get-OrgVdc test)
Get-CIVAppTemplateTotalUsage
Get-CIVAppTemplate test* | Get-CIVAppTemplateTotalUsage
Get-CIVAppTemplateVM
Get-CIVAppTemplate Google* | Get-CIVAppTempalteVM
Add-CIVAppToCatalog
Get-CIVApp Google* | Add-CIVAppToCatalog -VAppTemplateName test13 -Catalog (Get-Org labs | Get-Catalog test) -OrgVdc (Get-OrgVdc OvDC_LABS_C03)
Get-CIVAppNetworkingFirewallRules
Get-CIVApp Base-ePod-Basic-v8 | Get-CIVAppNetworkingFirewallRules
Get-CIVAppTotalUsage
Get-CIVApp test* | Get-CIVAppTotalUsage
Get-CIVCVM
Get-CIVM test* | Get-CIVCVM | Get-VMDiskFiles
Get-CIVMDiskFileChain
Get-CIVM "vpodrouter v3" | Get-CIVMDiskFileChain
Get-CIVMFencing
Get-CIVApp | Get-CIVM | Get-CIVMFencing
Get-CIVMHardDisk
Get-ProviderVdc Google* | Get-CIDatastore
Get-CIVMShadow
Get-CIVMShadow
DeployLab-FromOrgCatalogToAnotherOrgCatalog
Get-CIVAppTemplate HOL12-HyperV-SPwithAvamar-v9-Clint -Catalog (Get-Catalog HOLDEV_HOL12_CAT01) | DeployLab-FromOrgCatalogToAnotherOrgCatalog -ToOrgVdc @("OvDC_LABS_C01","OvDC_LABS_C02","OvDC_LABS_C03","OvDC_LABS_C04") -ToOrgVdcMC OvDC_HOLDEV_HOL12_C01_MC01 -prefix "MC_" -fromCatalog "HOLDEV_HOL12_CAT01" -ToOrg "Labs" -verbose
New-Org
New-Org -Name name -FullName fullname -Enabled:$true -PublishCatalogs:$true
New-OrgGroup
New-OrgGroup -Name name -GroupName GroupName -RoleName RoleName
Set-OrgLDAP
Set-OrgLDAP -name orgName –orgLDAPSystem:$true
New-OrgVdc2
New-OrgVdc2 –name fromOrg –FromOrgVdcName fromOrgVdc –orgVdcName newOrgVdc
Instantiate-VApp
Instantiate-VApp -name "test" -catalogname HOLDEV_HOL22_CAT01 -VAppTemplateName HOL22-Test-v1 -orgvdcname OvDC_HOLDEV_HOL22_C01 -mode Clone -poweron:$false -deploy:$false
Get-VMDiskFiles
Get-CIVM test* | Get-CIVCVM | Get-VMDiskFiles
Get-VMDiskUsage
Get-CIVM test* | Get-CIVCVM | Get-VMDiskUsage
Get-VMHostSoftware List
Get-VMHost | Get-VMHostSoftwareList | where {$_.name -match "vcloud"}
Get-VMHostDateTime
Get-VMHost -server vc01 | Get-VMHostDateTime