vmware management with powercli 5 - blog beat home … · vmware® management with powercli 5.1...

1
VMware vSphere ® PowerCLI Quick Reference Virtual Machine Operations Network Operations Virtual Switch Operations Port Group Operations To list all virtual switches attached to a VM and some of their properties, use: Get-VirtualSwitch -VM (Get-VM -Name "MS Win XP SP2") To create a new virtual switch: New-VirtualSwitch -VMHost (Get-VMHost -Name 192.168.0.10) -Name Switch02 To remove a virtual switch: $vs = Get-VirtualSwitch -VMHost 192.168.0.10 -Name VS23 Remove-VirtualSwitch -VirtualSwitch $vs To change the configuration of a virtual switch: $vs = New-VirtualSwitch -Host 192.168.0.10 -Name VirtSwitch Set-VirtualSwitch -VirtualSwitch $vs -MTU 500 To list all the port groups and some of their properties: $vs = Get-VirtualSwitch -VMHost 192.168.0.10 -Name Switch02 Get-VirtualPortGroup -VirtualSwitch $vs To add a new port group to a virtual switch: $vs = Get-VirtualSwitch -VMHost 192.168.0.10 -Name Switch02 $vpg = New-VirtualPortGroup -VirtualSwitch $vs -Name VPG1 Other cmdlets include: Remove-VirtualPortGroup Set-VirtualPortGroup Resource Pool Operations To list all resource pools on the connected VMware vSphere server and some of their properties: Get-ResourcePool To create a new resource pool: $clusterRootRP = Get-ResourcePool -Location (Get-Cluster ResearchAndDevelopmentCluster ) -Name Resources New-ResourcePool -Location $clusterRootRP -Name Developmen- tResources -CpuExpandableReservation $true -CpuReservationMhz 500 -CpuSharesLevel high -MemExpandableReservation $true -MemReservationMB 500 -MemSharesLevel high Other resource pool cmdlets: Move-ResourcePool Remove-ResourcePool Set-ResourcePool Task Information Snapshot Operations To list all tasks for a VMware vSphere server and some of their properties: Get-Task -Server (Connect-VIServer -Server 192.168.0.10 ) -Status Error To stop a task (example: stops the task of removing the VM): Stop-Task -Task (Remove-VM -VM "MS Win XP SP2" -Confirm -RunAsync) To wait until a task is completed before continuing: Wait-Task -Task (Remove-VM -VM "MS Win XP SP2" -Confirm -RunAsync) To list all the snapshots for all virtual machines: Get-VM | Get-Snapshot To snapshot a VM: New-Snapshot -VM "XP SP2" -Name BeforePatch1 To remove a snapshot: Remove-Snapshot -Snapshot $snapshot1 –RemoveChildren Other cmdlets include: Set-Snapshot Cluster Operations To list all the clusters on the connected VMware vSphere server and some of their properties: Get-Cluster To add a new cluster: New-Cluster -Name MyCluster -DRSEnabled -DRSMode FullyAutomated Other cluster cmdlets include: Move-Cluster Remove-Cluster Set-Cluster API Operations Returns a VMware vSphere.Net view object by specified search criteria. $vm = Get-View -ViewType VirtualMachine -Filter @{"Name" = "MS Win XP SP2"} $hostView = Get-View -ID $vm.Runtime.Host $hostView.Summary.Runtime Another example: (Get-View (Get-VMHost 'ESX1' | get-view).ConfigManager .VmotionSystem).SelectVnc('vmk0') API Reference: http://www.vmware.com/support/developer/vcsdk/visdk41pubs/ ApiReference/index.html Get-AlarmDefinition # Returns all the defined alarms on the servers you’re connected to. Get-AlarmDefinition -Name "virtual machine*" -Enabled $false # Returns all the disabled alarm definitions with names starting with “virtual machine.” Get-VMHost hostname | Get-AlarmDefinition # Returns all alarms that apply to the host “hostname”. Includes alarms defined on this host and alarms inherited from the parent entity, or from any ancestors in the inventory hierarchy. Modify an alarm definition: Get-AlarmDefinition "Host memory status" | Set-AlarmDefinition -Name "Host memory" -Enabled $false # This will rename the alarm to “Host memory” and disable it. ESXTOP through PowerCLI Logs/Reporting/Configuration Guest OS Virtual Machine Host Operations To list all VMs on the connected VMware vSphere server and some of their properties: Get-VM To create a new VM: $esxhost = Get-VMHost "ESXHost01.mydomain.com" New-VM -Name XPVM -VMHost $esxhost -DiskMB 4000 -MemoryMB 256 To remove a VM: Remove-VM -VM myVM –DeleteFromDisk To move a VM: Get-VM -Name XP_VC_Tech | Move-VM -Destination (Get-VMHost 192.168.0.10) To change the configuration of a VM: Set-VM -VM "Win XP SP1" -Name "Win XP SP2" -GuestId "winXP- ProGuest" -Description "My updated Win XP virtual machine." To run a script or command inside a VM: Invoke-VMScript -VM myVM -ScriptText "dir" Other VM-specific cmdlets include: M V - d n e p s u S M V - t r a t S Stop-VM Restart-VM The following is a list of all other VM-related cmdlets; use the Get-Help function with the -Examples switch for example uses: Get-CDDrive New-CDDrive Remove-CDDrive Set-CDDrive Get-FloppyDrive New-FloppyDrive Set-FloppyDrive Get-HardDisk New-HardDisk Set-HardDisk Get-NetworkAdapter New-NetworkAdapter Remove-NetworkAdapter Set-NetworkAdapter Get-VMGuest Restart-VMGuest Shutdown-VMGuest Suspend-VMGuest The following is a list of vApp cmdlets; use the Get-Help function for example uses: New-vApp -Name MyvApp -CpuLimitMhz 4000 -CpuReservationMhz 1000 -Location (Get-VMHost MyHost) Other vApp cmdlets: Export-vApp Stop-vApp Get-vApp Set-vApp Import-vApp Start-vApp Remove-vApp Virtual Machine Host Operations To list all the VMware vSphere servers (VMHost) on the connected vSphere server and some of their properties: Get-VMHost To add a new VMHost: Add-VMHost 192.168.0.10 -Location (Get-Datacenter Main) -User root -Password MyPass To remove a VMHost: $myVMHost = Get-VMHost 192.168.0.10 Remove-VMHost $myHost To move a VMHost: Move-VMHost 192.168.0.10 -Destination (Get-Datacenter MyDatacenter) To change the state of a VMHost: Set-VmHost -VmHost Host01 -State "Disconnected" The followingis a list of all other VMHost-related cmdlets: use the Get-Help function for example uses: Getting Started http://communities.vmware.com/docs/DOC-13700 VMware vSphere PowerCLI frequently asked questions (FAQs) link: http://communities.vmware.com/docs/DOC-13700 To find out what cmdlets are available: Get-VICommand To show documentation for all available cmdlets: Get-PowerCLIDocumentation For help with a cmdlet: Get-Help cmdlet-name –Full | More To connect to a VMware vSphere server. Start a new session or reestablish a previous session with a VMware vSphere server. $srv = Connect-VIServer –Server 192.168.0.10 -User Admin -Password Pass01 To disconnect from the connected vSphere server: Disconnect-VIServer -Server $srv -Confirm:$false For a list of datastores and other properties: Get-Datastore Other datastore cmdlets include: New-Datastore Remove-Datastore Set-Datastore The following is a list of all folder- related cmdlets; use the Get-Help function for example uses: Get-Folder Move-Folder New-Folder Remove-Folder Set-Folder The following is a list of security cmdlets; use the Get-Help function for example uses: Get-VIPermission -Entity ( Get-Datacenter) -Principal Administrator Other security cmdlets: VMware vSphere Server VMware ® Management with PowerCLI 5.1 Dismount-Tools Mount-Tools Update-Tools Wait-Tools Get-VMGuest Restart-VMGuest Shutdown-VMGuest Suspend-VMGuest Copy-VMGuestFile Get-VMGuestNetworkInterface Set-VMGuestNetworkInterface Get-VMGuestRoute New-VMGuestRoute Remove-VMGuestRoute Invoke-VMScript Get-iScsiHbaTarget New-iScsiHbaTarget Remove-iScsiHbaTarget Set-iScsiHbaTarget Get-NicTeamingPolicy Set-NicTeamingPolicy Get-OSCustomizationNicMapping New-OSCustomizationNicMapping Remove-OSCustomizationNicMapping Set-OSCustomizationNicMapping Get-ScsiController New-ScsiController Set-ScsiController Get-ScsiLun Set-ScsiLun Get-ScsiLunPath Set-ScsiLunPath Get-VirtualPortGroup New-VirtualPortGroup Remove-VirtualPortGroup Set-VirtualPortGroup Get-VirtualSwitch New-VirtualSwitch Remove-VirtualSwitch Set-VirtualSwitch Get-VMGuestNetworkInterface Set-VMGuestNetworkInterface Get-VMGuestRoute New-VMGuestRoute Remove-VMGuestRoute Get-VMHostFirewallDefaultPolicy Set-VMHostFirewallDefaultPolicy Get-VMHostFirewallException Set-VMHostFirewallException Get-VMHostHba Set-VMHostHba Get-VMHostNetwork Set-VMHostNetwork Get-VMHostNetworkAdapter New-VMHostNetworkAdapter Remove-VMHostNetworkAdapter Set-VMHostNetworkAdapter Add-VmHostNtpServer Get-VMHostNtpServer Remove-VMHostNtpServer Test-VMHostSnmp Get-VMHostSnmp Set-VMHostSnmp Get-EsxTop –Counter # View the fields available for vCPU counter: (Get-EsxTop –Counter –CounterName VCPU).Fields Get-EsxTop –TopologyInfo # View the entries of a specific topology: (Get-EsxTop –TopologyInfo –Topology SchedGroup).Entries | Format-Table # Retrieve the counter values for “VCPU” and “SchedGroup" counters: Get-EsxTop –CounterName VCPU | Format-Table * -AutoSize Get-EsxTop –CounterName SchedGroup | Format-Table * -AutoSize Host Operations vCenter Update Manager Get-PatchBaseline New-PatchBaseline Set-PatchBaseline Remediate-Inventory Scan-Inventory Attach-Baseline Detach-Baseline Get-Baseline Remove-Baseline For latest documentation, sample code, and information, visit: http://vmware.com/go/powercliupdate Get-Compliance Download-Patch Get-Patch Stage-Patch Datacenter Operations Cluster Operations Get-Datacenter Move-Datacenter New-Datacenter Remove-Datacenter Set-Datacenter Resource Pool Operations Get-ResourcePool Move-ResourcePool New-ResourcePool Remove-ResourcePool Set-ResourcePool Get-Cluster Get-DatastoreCluster Move-Cluster New-Cluster Remove-Cluster Set-Cluster Resources VMware scripting support - http://vmware.com/go/sdksupport vSphere PowerCLI training - http://vmware.com/go/vsphereautomation Third-party PowerCLI training from Trainsignal: http://trainsignal.com Special thanks to our PowerCLI VIP community members for helping us improve PowerCLI. Automating vSphere Administration ISBN-10: 0470890797 vSphere 4.0 Quick Start Guide ISBN-10: 1439263450 Managing VMware Infrastructure with Windows PowerShell ISBN-10: 0982131402 Get-ErrorReport Get-PowerCLICommunity Get-PowerCLIConfiguration Set-PowerCLIConfiguration Get-PowerCLIDocumentation Get-PowerCLIVersion PowerCLI Books PowerCLI Settings VMware vSphere PowerCLI is a powerful, easy-to-use scripting interface to manage the vSphere platform. Administrators can leverage more than 360 commandlets to simplify everyday tasks. For latest documentation, sample code, and information, visit: http://vmware.com/go/powercli http://blogs.vmware.com/vipowershell Apply-VMHostProfile Export-VMHostProfile Get-VMHostProfile Import-VMHostProfile New-VMHostProfile Remove-VMHostProfile Set-VMHostProfile Test-VMHostProfileCompliance Export-vApp Get-vApp Import-vApp Move-Vapp New-vApp Remove-vApp Set-vApp Start-vApp Stop-vApp Host Profiles vApps PowerShell for View Operations The following operations may not integrate with the core PowerCLI cmdlets as expected. Auto Deploy Operations Switch-ActiveDeployRuleSet Repair-DeployImageCache Add-DeployRule Copy-DeployRule Get-DeployRule New-DeployRule Remove-DeployRule Set-DeployRule Get-DeployRuleSet Set-DeployRuleSet Repair-DeployRuleSetCompliance Test-DeployRuleSetCompliance Apply-ESXImageProfile Get-VMHostAttributes Get-VMHostImageProfile Get-VMHostMatchingRules Image Builder Operations Get-LicenseDataManager Licensing Operations vCloud Operations vApp Operations How to Connect to vCenter Server or ESX and ESXi Security Operations Datacenter Operations To list all datacenters from a VMware vSphere server: Get-Datacenter To add a new datacenter: New-Datacenter -Name France Other datastore cmdlets: Move-Datacenter Remove-Datacenter Set-Datacenter DRS Rules Retrieve a list of DRS rules for the specified clusters: Get-DrsRule -Cluster (Get-Cluster “Production”) Other DRS rule cmdlets: New-DrsRule Remove-DrsRule Set-DrsRule Managing Events Alarms Datastore Operations Folder Operations PowerShell PowerCLI vSphere vCloud Licensing Image Builder Auto Deploy Update Manager View Copy-VMGuestFile Get-VMGuestNetworkInterface Set-VMGuestNetworkInterface Get-VMGuestRoute New-VMGuestRoute Remove-VMGuestRoute Set-VMGuestRoute Get-VMQuestion Set-VMQuestion Get-VMResourceConfiguration Set-VMResourceConfiguration Get-VMStartPolicy Set-VMStartPolicy Restart-VMHost Start-VMHost Stop-VMHost Suspend-VMHost Get-VMHostAccount New-VMHostAccount Set-VMHostAccount Remove-VMHostAccount Set-VMHostAdvancedConfiguration Get-VMHostAdvancedConfiguration Get-VMHostDiagnosticPartition Set-VMHostDiagnosticPartition Get-VMHostFirewallDefaultPolicy Set-VMHostFirewallDefaultPolicy Get-VMHostFirewallException Set-VMHostFirewallException Get-VMHostFirmware Set-VMHostFirmware Get-VMHostModule Set-VMHostModule Get-VMHostNetwork Set-VMHostNetwork New-VMHostNetworkAdapter Remove-VMHostNetworkAdapter Set-VMHostNetworkAdapter Add-VMHostNtpServer Get-VMHostNtpServer Remove-VMHostNtpServer *-VMHostPatch *-VMHostRoute Get-VMHostService Set-VMHostService Restart-VMHostService Start-VMHostService Stop-VMHostService Get-VMHostSnmp Test-VMHostSnmp Set-VMHostSnmp Get-VMHostStartPolicy Set-VMHostStartPolicy Get-VMHostStorage Get-VMHostSysLogServer Set-VMHostSysLogServer New-VIPermission Remove-VIPermission Set-VIPermission Get-VIPrivilege Get-VIRole New-VIRole Remove-VIRole Set-VIRole Get-CDDrive New-CDDrive Remove-CDDrive Set-CDDrive Get-FloppyDrive New-FloppyDrive Remove-FloppyDrive Set-FloppyDrive Copy-HardDisk Get-HardDisk New-HardDisk Remove-HardDisk Set-HardDisk New-NetworkAdapter Remove-NetworkAdapter Set-NetworkAdapter Add-PassthroughDevice Get-PassthroughDevice Remove-PassthroughDevice Get-Snapshot New-Snapshot Remove-Snapshot Set-Snapshot Get-Template Move-Template New-Template Remove-Template Set-Template Get-UsbDevice Remove-UsbDevice Get-VM Move-VM New-VM Restart-VM Remove-VM Set-VM Start-VM Stop-VM Suspend-VM Get-VMQuestion Set-VMQuestion Get-VMResourceConfiguration Set-VMResourceConfiguration Get-VMStartPolicy Set-VMStartPolicy Get-ErrorReport Get-Log Get-LogType Get-OSCustomizationSpec New-OSCustomizationSpec Remove-OSCustomizationSpec Set-OSCustomizationSpec Get-Stat Get-StatInterval New-StatInterval Remove-StatInterval Set-StatInterval Get-StatType Get-VICredentialStoreItem New-VICredentialStoreItem Remove-VICredentialStoreItem Get-VMHostSysLogServer Set-VMHostSysLogServer Get-VMResourceConguration Get-VIEvent Get-VIProperty New-VIProperty Compare-EsxImageProfile Export-EsxImageProfile Get-EsxImageProfile New-EsxImageProfile Set-EsxImageProfile Get-EsxSoftwareChannel Add-EsxSoftwareDepot Remove-EsxSoftwareDepot Add-EsxSoftwarePackage Get-EsxSoftwarePackage Remove-EsxSoftwarePackage Connect-CIServer Disconnect-CIServer Get-Catalog Get-CIAccessControlRule Set-CIAccessControlRule New-CIAccessControlRule Remove-CIAccessControlRule Add-CIDatastore Get-CIDatastore Set-CINetworkAdapter Get-CINetworkAdapter Add-AutomaticPool Update-AutomaticPool Add-AutomaticLinkedClonePool Update-AutomaticLinkedClonePool Get-ComposerDomain Get-ConnectionBroker Update-ConnectionBroker Get-DesktopPhysicalMachine Get-DesktopVM Get-EventReport Get-EventReportList Get-GlobalSetting Update-GlobalSetting Get-License Set-License Send-LinkedCloneRebalance Send-LinkedCloneRecompose Send-LinkedCloneRefresh Get-LocalSession Send-LocalSessionRollback Add-ManualPool Update-ManualPool Add-ManualUnmanagedPool Update-ManualUnmanagedPool Get-Monitor Get-Pool Remove-Pool Add-PoolEntitlement Get-PoolEntitlement Remove-PoolEntitlement Get-ProfileDisk Get-TerminalServer Add-TerminalServerPool Update-TerminalServerPool Get-RemoteSession Send-SessionDisconnect Get-User Remove-UserOwnership Update-UserOwnership Add-ViewVC Get-ViewVC Remove-ViewVC Update-ViewVC Send-VMReset Get-HAPrimaryVMHost Add-VMHost Get-VMHost Move-VMHost Remove-VMHost Restart-VMHost Set-VMHost Start-VMHost Stop-VMHost Suspend-VMHost Get-VMHostAccount New-VMHostAccount Set-VMHostAccount Remove-VMHostAccount Get-VMHostAdvancedConfiguration Set-VMHostAdvancedConfiguration Get-VMHostAuthentication Set-VMHostAuthentication Get-VMHostAvailableTimeZone Get-VMHostDiagnosticPartition Set-VMHostDiagnosticPartition Get-VMHostDisk Format-VMHostDiskPartition Get-VMHostDiskPartition Get-VMHostFirmware Set-VMHostFirmware Get-VMHostModule Set-VMHostModule Get-VMHostPatch Install-VMHostPatch Get-VMHostProfileRequiredInput Get-VMHostRoute New-VMHostRoute Remove-VMHostRoute Set-VMHostRoute Get-VMHostService Restart-VMHostService Set-VMHostService Start-VMHostService Stop-VMHostService Get-VMHostStorage Set-VMHostStorage Get-VMHostStartPolicy Set-VMHostStartPolicy Get-VMHostSysLogServer Set-VMHostSysLogServer Get-AdvancedSetting New-AdvancedSetting Remove-AdvancedSetting Set-AdvancedSetting Get-AlarmAction New-AlarmAction Remove-AlarmAction Get-AlarmActionTrigger New-AlarmActionTrigger Remove-AlarmActionTrigger Get-AlarmDefinition Set-AlarmDefinition Get-Annotation Set-Annotation Get-CustomAttribute New-CustomAttribute Remove-CustomAttribute Set-CustomAttribute New-Datastore Remove-Datastore Get-Datastore Set-Datastore Copy-DatastoreItem Apply-DrsRecommendation Get-DrsRecommendation Get-DrsRule New-DrsRule Remove-DrsRule Set-DrsRule Get-EsxCli Get-EsxTop Move-Folder New-Folder Get-Folder Remove-Folder Set-Folder Get-Inventory Move-Inventory Remove-Inventory Get-NetworkAdapter Get-Task Stop-Task Wait-Task Get-VIAccount Get-View Get-VIObjectByVIView Get-VIPermission New-VIPermission Remove-VIPermission Set-VIPermission Get-VIPrivilege New-VIProperty Remove-VIProperty Get-VIRole New-VIRole Remove-VIRole Set-VIRole Connect-VIServer Disconnect-VIServer Get-CIRole Get-CIUser Start-CIVApp Import-CIVApp New-CIVApp Restart-CIVApp Remove-CIVApp Set-CIVApp Stop-CIVApp Suspend-CIVApp Get-CIVApp Stop-CIVAppGuest Restart-CIVAppGuest Set-CIVAppNetwork Get-CIVAppNetwork Remove-CIVAppNetwork New-CIVAppNetwork Set-CIVAppStartRule Get-CIVAppStartRule Import-CIVAppTemplate Remove-CIVAppTemplate Set-CIVAppTemplate Get-CIVAppTemplate New-CIVAppTemplate Get-CIView Start-CIVM Stop-CIVM Restart-CIVM Get-CIVM Suspend-CIVM Stop-CIVMGuest Restart-CIVMGuest Search-Cloud Get-ExternalNetwork Get-Media Get-NetworkPool Get-Org Remove-Org Set-Org New-Org Get-OrgNetwork Remove-OrgNetwork Set-OrgNetwork New-OrgNetwork New-OrgVdc Remove-OrgVdc Set-OrgVdc Get-OrgVdc Get-ProviderVdc Connect to a depot: Add-EsxSoftwareDepot https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml Add a package by name to an image profile: Add-EsxSoftwarePackage -ImageProfile "My custom profile" -SoftwarePackage net-bnx2 Clone an image profile, then add a package by name: New-EsxImageProfile -CloneProfile "ESX-5.0-234567-standard" -Name "My custom profile" | Add-EsxSoftwarePackage net-bnx2 Export an ISO image Export-EsxImageProfile -ImageProfile "Evan's Profile" -ExportToIso -FilePath c:\isos\evans-iso.iso Clone an image profile, add a software package, then export to offline bundle. New-EsxImageProfile -CloneProfile "ESXi-5.0.0-234567-standard" -Name "Evan's Profile" Add-EsxSoftwarePackage -ImageProfile "Evan's Profile" -SoftwarePackage cisco-vem-v140 Export-EsxImageProfile -ImageProfile "Evan's Profile" -ExportToBundle -FilePath c:\isos\base-plus-vem.zip Display all image profiles from depots and all image profiles the user created during this PowerCLI session: Get-EsxImageProfile List all the VIBs, sorted by date: Get-EsxSoftwarePackage | Sort-Object ReleaseDate | Format-Table -Property Name,Version,Vendor List all the VIBs from VMware and Cisco released after Jan 1, 2010: Get-EsxSoftwarePackage -Vendor "VMware","Cisco" -ReleasedAfter 1/1/2010 List all the VIBs from vendors other than VMware Get-EsxSoftwarePackage | ? {$_.Vendor -ne "VMware"} Clone an image profile, give it a new name, and change the acceptance level. New-EsxImageProfile -CloneProfile "ESX-5.0-234567-standard" -Name "My custom profile" -AcceptanceLevel CommunitySupported Connect to a depot, then disconnect from it by URL. Add-EsxSoftwareDepot https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml Remove package foo from my custom profile: Remove-EsxSoftwarePackage -ImageProfile "My custom profile" -SoftwarePackage foo Modify the VIB list of an existing image profile Set-EsxImageProfile -ImageProfile "Profile of a Fool" -SoftwarePackage esx-base,scsi-ips,esx-tboot Image Builder vCloud Tenant Operations Get-PowerCLIVersion Get-Task Get-VICredentialStoreItem Import-CIVAppTemplate New-CIAccessControlRule New-CIVApp New-CIVAppNetwork New-CIVAppTemplate New-VICredentialStoreItem Remove-CIAccessControlRule Remove-CIVApp Remove-CIVAppNetwork Remove-CIVAppTemplate Remove-VICredentialStoreItem Restart-CIVApp Restart-CIVAppGuest Restart-CIVM Restart-CIVMGuest Search-Cloud Set-CIAccessControlRule Set-CINetworkAdapter Set-CIVApp Set-CIVAppNetwork Set-CIVAppStartRule Set-CIVAppTemplate Set-Org Set-PowerCLIConfiguration Start-CIVApp Start-CIVM Stop-CIVApp Stop-CIVAppGuest Stop-CIVM Stop-CIVMGuest Stop-Task Suspend-CIVApp Suspend-CIVM Wait-Task vCloud Tenant C M Y CM MY CY CMY K Managing VMware wi.pdf 1 8/7/12 10:33 AM

Upload: trinhngoc

Post on 10-Apr-2018

218 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: VMware Management with PowerCLI 5 - Blog Beat Home … · VMware® Management with PowerCLI 5.1 Dismount-Tools Mount-Tools ... Test-VMHostSnmp ... Remediate-Inventory Scan-In ventory

VMware vSphere® PowerCLI Quick ReferenceVirtual Machine Operations

Network Operations

Virtual Switch Operations

Port Group Operations

To list all virtual switches attached to a VM and some of their properties, use:

Get-VirtualSwitch -VM (Get-VM -Name "MS Win XP SP2")

To create a new virtual switch:

New-VirtualSwitch -VMHost (Get-VMHost -Name 192.168.0.10) -Name Switch02

To remove a virtual switch:

$vs = Get-VirtualSwitch -VMHost 192.168.0.10 -Name VS23Remove-VirtualSwitch -VirtualSwitch $vs

To change the configuration of a virtual switch:

$vs = New-VirtualSwitch -Host 192.168.0.10 -Name VirtSwitch

Set-VirtualSwitch -VirtualSwitch $vs -MTU 500

To list all the port groups and some of their properties:

$vs = Get-VirtualSwitch -VMHost 192.168.0.10 -Name Switch02Get-VirtualPortGroup -VirtualSwitch $vs

To add a new port group to a virtual switch:

$vs = Get-VirtualSwitch -VMHost 192.168.0.10 -Name Switch02

$vpg = New-VirtualPortGroup -VirtualSwitch $vs -Name VPG1

Other cmdlets include:

Remove-VirtualPortGroupSet-VirtualPortGroup

Resource Pool Operations

To list all resource pools on the connected VMware vSphere server and some of

their properties: Get-ResourcePool

To create a new resource pool:

$clusterRootRP = Get-ResourcePool -Location (Get-Cluster ResearchAndDevelopmentCluster ) -Name Resources

New-ResourcePool -Location $clusterRootRP -Name Developmen-tResources -CpuExpandableReservation $true -CpuReservationMhz 500 -CpuSharesLevel high -MemExpandableReservation $true -MemReservationMB 500 -MemSharesLevel high

Other resource pool cmdlets:

Move-ResourcePoolRemove-ResourcePool

Set-ResourcePool

Task Information

Snapshot Operations

To list all tasks for a VMware vSphere server and some of their properties:

Get-Task -Server (Connect-VIServer -Server 192.168.0.10) -Status Error

To stop a task (example: stops the task of removing the VM):

Stop-Task -Task (Remove-VM -VM "MS Win XP SP2" -Confirm -RunAsync)

To wait until a task is completed before continuing:

Wait-Task -Task (Remove-VM -VM "MS Win XP SP2" -Confirm -RunAsync)

To list all the snapshots for all virtual machines:

Get-VM | Get-Snapshot

To snapshot a VM:

New-Snapshot -VM "XP SP2" -Name BeforePatch1

To remove a snapshot:

Remove-Snapshot -Snapshot $snapshot1 –RemoveChildren

Other cmdlets include:

Set-Snapshot

Cluster Operations

To list all the clusters on the connected VMware vSphere server and some of

their properties: Get-Cluster

To add a new cluster:

New-Cluster -Name MyCluster -DRSEnabled -DRSMode FullyAutomated

Other cluster cmdlets include:

Move-Cluster Remove-Cluster Set-Cluster

API Operations

Returns a VMware vSphere.Net view object by specified search criteria.

$vm = Get-View -ViewType VirtualMachine -Filter @{"Name" = "MS Win XP SP2"}

$hostView = Get-View -ID $vm.Runtime.Host

$hostView.Summary.Runtime

Another example:

(Get-View (Get-VMHost 'ESX1' | get-view).ConfigManager.VmotionSystem).SelectVnc('vmk0')

API Reference:

http://www.vmware.com/support/developer/vcsdk/visdk41pubs/

ApiReference/index.html

Get-AlarmDefinition # Returns all the defined alarms on the servers

you’re connected to.

Get-AlarmDefinition -Name "virtual machine*" -Enabled $false

# Returns all the disabled alarm definitions with names starting with

“virtual machine.”

Get-VMHost hostname | Get-AlarmDefinition # Returns all alarms that

apply to the host “hostname”. Includes alarms defined on this host and

alarms inherited from the parent entity, or from any ancestors in the

inventory hierarchy.

Modify an alarm definition: Get-AlarmDefinition "Host memory status" |

Set-AlarmDefinition -Name "Host memory" -Enabled $false

# This will rename the alarm to “Host memory” and disable it.

ESXTOP through PowerCLI

Logs/Reporting/Configuration

Guest OS

Virtual Machine Host Operations

To list all VMs on the connected VMware vSphere server and some of their

properties: Get-VM

To create a new VM:

$esxhost = Get-VMHost "ESXHost01.mydomain.com"New-VM -Name XPVM -VMHost $esxhost -DiskMB 4000 -MemoryMB 256

To remove a VM:

Remove-VM -VM myVM –DeleteFromDisk

To move a VM:

Get-VM -Name XP_VC_Tech | Move-VM -Destination (Get-VMHost 192.168.0.10)

To change the configuration of a VM:

Set-VM -VM "Win XP SP1" -Name "Win XP SP2" -GuestId "winXP-ProGuest" -Description "My updated Win XP virtual machine."

To run a script or command inside a VM:

Invoke-VMScript -VM myVM -ScriptText "dir"

Other VM-specific cmdlets include:

MV-dnepsuS MV-tratS Stop-VM Restart-VM

The following is a list of all other VM-related cmdlets; use the Get-Help

function with the -Examples switch for example uses:

Get-CDDriveNew-CDDrive

Remove-CDDriveSet-CDDrive

Get-FloppyDriveNew-FloppyDriveSet-FloppyDrive

Get-HardDiskNew-HardDiskSet-HardDisk

Get-NetworkAdapterNew-NetworkAdapter

Remove-NetworkAdapterSet-NetworkAdapter

Get-VMGuestRestart-VMGuest

Shutdown-VMGuestSuspend-VMGuest

The following is a list of vApp cmdlets; use the Get-Help function for example uses:

New-vApp -Name MyvApp -CpuLimitMhz 4000 -CpuReservationMhz 1000 -Location (Get-VMHost MyHost)

Other vApp cmdlets:

Export-vApp Stop-vApp Get-vApp Set-vApp Import-vApp Start-vApp Remove-vApp

Virtual Machine Host Operations

To list all the VMware vSphere servers (VMHost) on the connected

vSphere server and some of their properties:

Get-VMHost

To add a new VMHost:

Add-VMHost 192.168.0.10 -Location (Get-Datacenter Main) -User root -Password MyPass

To remove a VMHost:

$myVMHost = Get-VMHost 192.168.0.10Remove-VMHost $myHost

To move a VMHost:

Move-VMHost 192.168.0.10 -Destination (Get-Datacenter MyDatacenter)

To change the state of a VMHost:

Set-VmHost -VmHost Host01 -State "Disconnected"

The followingis a list of all other VMHost-related cmdlets: use the Get-Help

function for example uses:

Getting Started

http://communities.vmware.com/docs/DOC-13700

VMware vSphere PowerCLI frequently asked questions (FAQs) link:

http://communities.vmware.com/docs/DOC-13700

To find out what cmdlets are available: Get-VICommand

To show documentation for all available cmdlets: Get-PowerCLIDocumentation

For help with a cmdlet: Get-Help cmdlet-name –Full | More

To connect to a VMware vSphere server. Start a new session or reestablish a

previous session with a VMware vSphere server.

$srv = Connect-VIServer –Server 192.168.0.10 -User Admin -Password Pass01

To disconnect from the connected vSphere server:

Disconnect-VIServer -Server $srv -Confirm:$false

For a list of datastores and other

properties:

Get-Datastore

Other datastore cmdlets include:

New-DatastoreRemove-Datastore

Set-Datastore

The following is a list of all folder-

related cmdlets; use the Get-Help

function for example uses:

Get-FolderMove-FolderNew-Folder

Remove-FolderSet-Folder

The following is a list of security cmdlets; use the Get-Help function for example uses:

Get-VIPermission -Entity (Get-Datacenter) -Principal Administrator

Other security cmdlets:

VMware vSphere Server

VMware® Management with PowerCLI 5.1

Dismount-ToolsMount-Tools

Update-ToolsWait-Tools

Get-VMGuestRestart-VMGuest

Shutdown-VMGuestSuspend-VMGuestCopy-VMGuestFile

Get-VMGuestNetworkInterfaceSet-VMGuestNetworkInterface

Get-VMGuestRouteNew-VMGuestRoute

Remove-VMGuestRouteInvoke-VMScript

Get-iScsiHbaTargetNew-iScsiHbaTarget

Remove-iScsiHbaTargetSet-iScsiHbaTarget

Get-NicTeamingPolicySet-NicTeamingPolicy

Get-OSCustomizationNicMappingNew-OSCustomizationNicMapping

Remove-OSCustomizationNicMappingSet-OSCustomizationNicMapping

Get-ScsiControllerNew-ScsiController

Set-ScsiControllerGet-ScsiLunSet-ScsiLun

Get-ScsiLunPathSet-ScsiLunPath

Get-VirtualPortGroupNew-VirtualPortGroup

Remove-VirtualPortGroupSet-VirtualPortGroup

Get-VirtualSwitchNew-VirtualSwitch

Remove-VirtualSwitchSet-VirtualSwitch

Get-VMGuestNetworkInterfaceSet-VMGuestNetworkInterface

Get-VMGuestRouteNew-VMGuestRoute

Remove-VMGuestRouteGet-VMHostFirewallDefaultPolicySet-VMHostFirewallDefaultPolicy

Get-VMHostFirewallExceptionSet-VMHostFirewallException

Get-VMHostHbaSet-VMHostHba

Get-VMHostNetworkSet-VMHostNetwork

Get-VMHostNetworkAdapterNew-VMHostNetworkAdapter

Remove-VMHostNetworkAdapterSet-VMHostNetworkAdapter

Add-VmHostNtpServerGet-VMHostNtpServer

Remove-VMHostNtpServerTest-VMHostSnmpGet-VMHostSnmpSet-VMHostSnmp

Get-EsxTop –Counter

# View the fields available for vCPU counter:

(Get-EsxTop –Counter –CounterName VCPU).Fields

Get-EsxTop –TopologyInfo

# View the entries of a specific topology:

(Get-EsxTop –TopologyInfo –Topology SchedGroup).Entries | Format-Table

# Retrieve the counter values for “VCPU” and “SchedGroup" counters:

Get-EsxTop –CounterName VCPU | Format-Table * -AutoSize

Get-EsxTop –CounterName SchedGroup | Format-Table * -AutoSize

Host Operations vCenter Update Manager

Get-PatchBaselineNew-PatchBaseline

Set-PatchBaselineRemediate-Inventory

Scan-Inventory

Attach-BaselineDetach-Baseline

Get-BaselineRemove-Baseline

For latest documentation, sample code, and information, visit:http://vmware.com/go/powercliupdate

Get-ComplianceDownload-Patch

Get-PatchStage-Patch

Datacenter Operations

Cluster Operations

Get-DatacenterMove-DatacenterNew-Datacenter

Remove-DatacenterSet-Datacenter

Resource Pool Operations

Get-ResourcePoolMove-ResourcePoolNew-ResourcePool

Remove-ResourcePoolSet-ResourcePool

Get-ClusterGet-DatastoreCluster

Move-ClusterNew-Cluster

Remove-ClusterSet-Cluster

Resources

VMware scripting support - http://vmware.com/go/sdksupportvSphere PowerCLI training - http://vmware.com/go/vsphereautomation

Third-party PowerCLI training from Trainsignal: http://trainsignal.com

Special thanks to our PowerCLI VIP community members for helping us improve PowerCLI.

Automating vSphere Administration ISBN-10: 0470890797

vSphere 4.0 Quick Start Guide ISBN-10: 1439263450

Managing VMware Infrastructure with Windows PowerShell ISBN-10: 0982131402

Get-ErrorReportGet-PowerCLICommunity

Get-PowerCLIConfigurationSet-PowerCLIConfiguration

Get-PowerCLIDocumentationGet-PowerCLIVersion

PowerCLI Books PowerCLI Settings

VMware vSphere PowerCLI is a powerful, easy-to-use scripting interface to manage the

vSphere platform. Administrators can leverage more than 360 commandlets to

simplify everyday tasks.

For latest documentation, sample code, and information, visit:

http://vmware.com/go/powercli

http://blogs.vmware.com/vipowershell

Apply-VMHostProfileExport-VMHostProfile

Get-VMHostProfileImport-VMHostProfile

New-VMHostProfileRemove-VMHostProfile

Set-VMHostProfileTest-VMHostProfileCompliance

Export-vAppGet-vApp

Import-vAppMove-VappNew-vApp

Remove-vAppSet-vApp

Start-vAppStop-vApp

Host Profiles

vAppsPowerShell for View Operations

The following operations may not integrate with the core PowerCLI cmdlets as expected.

Auto Deploy Operations

Switch-ActiveDeployRuleSetRepair-DeployImageCache

Add-DeployRuleCopy-DeployRule

Get-DeployRuleNew-DeployRule

Remove-DeployRuleSet-DeployRule

Get-DeployRuleSetSet-DeployRuleSet

Repair-DeployRuleSetComplianceTest-DeployRuleSetCompliance

Apply-ESXImageProfileGet-VMHostAttributes

Get-VMHostImageProfileGet-VMHostMatchingRules

Image Builder Operations

Get-LicenseDataManager

Licensing Operations

vCloud Operations

vApp Operations

How to Connect to vCenter Server or ESX and ESXi

Security Operations

Datacenter Operations

To list all datacenters from a VMware

vSphere server:

Get-Datacenter

To add a new datacenter:

New-Datacenter -Name France

Other datastore cmdlets:

Move-DatacenterRemove-Datacenter

Set-Datacenter

DRS Rules

Retrieve a list of DRS rules for the

specified clusters:

Get-DrsRule -Cluster (Get-Cluster “Production”)

Other DRS rule cmdlets:

New-DrsRuleRemove-DrsRule

Set-DrsRule

Managing Events Alarms

Datastore Operations Folder Operations

PowerShell

PowerCLI

vSphere vCloud Licensing

ImageBuilder

AutoDeploy

UpdateManager

View

Copy-VMGuestFileGet-VMGuestNetworkInterfaceSet-VMGuestNetworkInterface

Get-VMGuestRouteNew-VMGuestRoute

Remove-VMGuestRouteSet-VMGuestRouteGet-VMQuestionSet-VMQuestion

Get-VMResourceConfigurationSet-VMResourceConfiguration

Get-VMStartPolicySet-VMStartPolicy

Restart-VMHostStart-VMHostStop-VMHost

Suspend-VMHostGet-VMHostAccountNew-VMHostAccountSet-VMHostAccount

Remove-VMHostAccountSet-VMHostAdvancedConfigurationGet-VMHostAdvancedConfiguration

Get-VMHostDiagnosticPartitionSet-VMHostDiagnosticPartition

Get-VMHostFirewallDefaultPolicySet-VMHostFirewallDefaultPolicy

Get-VMHostFirewallExceptionSet-VMHostFirewallException

Get-VMHostFirmwareSet-VMHostFirmware

Get-VMHostModuleSet-VMHostModule

Get-VMHostNetworkSet-VMHostNetwork

New-VMHostNetworkAdapterRemove-VMHostNetworkAdapter

Set-VMHostNetworkAdapterAdd-VMHostNtpServerGet-VMHostNtpServer

Remove-VMHostNtpServer*-VMHostPatch*-VMHostRoute

Get-VMHostServiceSet-VMHostService

Restart-VMHostServiceStart-VMHostServiceStop-VMHostService

Get-VMHostSnmpTest-VMHostSnmpSet-VMHostSnmp

Get-VMHostStartPolicySet-VMHostStartPolicy

Get-VMHostStorageGet-VMHostSysLogServerSet-VMHostSysLogServer

New-VIPermissionRemove-VIPermission

Set-VIPermission

Get-VIPrivilegeGet-VIRoleNew-VIRole

Remove-VIRoleSet-VIRole

Get-CDDriveNew-CDDrive

Remove-CDDriveSet-CDDrive

Get-FloppyDriveNew-FloppyDrive

Remove-FloppyDriveSet-FloppyDrive

Copy-HardDiskGet-HardDisk

New-HardDiskRemove-HardDisk

Set-HardDiskNew-NetworkAdapter

Remove-NetworkAdapterSet-NetworkAdapter

Add-PassthroughDeviceGet-PassthroughDevice

Remove-PassthroughDeviceGet-Snapshot

New-SnapshotRemove-Snapshot

Set-SnapshotGet-Template

Move-TemplateNew-Template

Remove-TemplateSet-Template

Get-UsbDeviceRemove-UsbDevice

Get-VMMove-VMNew-VM

Restart-VMRemove-VM

Set-VMStart-VMStop-VM

Suspend-VM

Get-VMQuestionSet-VMQuestion

Get-VMResourceConfigurationSet-VMResourceConfiguration

Get-VMStartPolicySet-VMStartPolicy

Get-ErrorReportGet-Log

Get-LogTypeGet-OSCustomizationSpec

New-OSCustomizationSpecRemove-OSCustomizationSpec

Set-OSCustomizationSpecGet-Stat

Get-StatIntervalNew-StatInterval

Remove-StatInterval

Set-StatIntervalGet-StatType

Get-VICredentialStoreItemNew-VICredentialStoreItem

Remove-VICredentialStoreItemGet-VMHostSysLogServerSet-VMHostSysLogServer

Get-VMResourceCongurationGet-VIEvent

Get-VIPropertyNew-VIProperty

Compare-EsxImageProfileExport-EsxImageProfile

Get-EsxImageProfileNew-EsxImageProfile

Set-EsxImageProfile Get-EsxSoftwareChannel

Add-EsxSoftwareDepotRemove-EsxSoftwareDepot

Add-EsxSoftwarePackageGet-EsxSoftwarePackage

Remove-EsxSoftwarePackage

Connect-CIServerDisconnect-CIServer

Get-CatalogGet-CIAccessControlRuleSet-CIAccessControlRule

New-CIAccessControlRuleRemove-CIAccessControlRule

Add-CIDatastoreGet-CIDatastore

Set-CINetworkAdapterGet-CINetworkAdapter

Add-AutomaticPoolUpdate-AutomaticPool

Add-AutomaticLinkedClonePoolUpdate-AutomaticLinkedClonePool

Get-ComposerDomainGet-ConnectionBroker

Update-ConnectionBrokerGet-DesktopPhysicalMachine

Get-DesktopVMGet-EventReport

Get-EventReportListGet-GlobalSetting

Update-GlobalSettingGet-LicenseSet-License

Send-LinkedCloneRebalanceSend-LinkedCloneRecompose

Send-LinkedCloneRefreshGet-LocalSession

Send-LocalSessionRollbackAdd-ManualPool

Update-ManualPoolAdd-ManualUnmanagedPool

Update-ManualUnmanagedPool

Get-MonitorGet-Pool

Remove-PoolAdd-PoolEntitlementGet-PoolEntitlement

Remove-PoolEntitlementGet-ProfileDisk

Get-TerminalServerAdd-TerminalServerPool

Update-TerminalServerPoolGet-RemoteSession

Send-SessionDisconnect

Get-UserRemove-UserOwnershipUpdate-UserOwnership

Add-ViewVCGet-ViewVC

Remove-ViewVCUpdate-ViewVCSend-VMReset

Get-HAPrimaryVMHostAdd-VMHostGet-VMHost

Move-VMHostRemove-VMHostRestart-VMHost

Set-VMHostStart-VMHostStop-VMHost

Suspend-VMHostGet-VMHostAccount

New-VMHostAccountSet-VMHostAccount

Remove-VMHostAccountGet-VMHostAdvancedConfigurationSet-VMHostAdvancedConfiguration

Get-VMHostAuthenticationSet-VMHostAuthentication

Get-VMHostAvailableTimeZoneGet-VMHostDiagnosticPartitionSet-VMHostDiagnosticPartition

Get-VMHostDiskFormat-VMHostDiskPartition

Get-VMHostDiskPartitionGet-VMHostFirmwareSet-VMHostFirmware

Get-VMHostModuleSet-VMHostModule

Get-VMHostPatchInstall-VMHostPatch

Get-VMHostProfileRequiredInputGet-VMHostRoute

New-VMHostRouteRemove-VMHostRoute

Set-VMHostRouteGet-VMHostService

Restart-VMHostServiceSet-VMHostService

Start-VMHostServiceStop-VMHostServiceGet-VMHostStorageSet-VMHostStorage

Get-VMHostStartPolicySet-VMHostStartPolicy

Get-VMHostSysLogServerSet-VMHostSysLogServer

Get-AdvancedSettingNew-AdvancedSetting

Remove-AdvancedSettingSet-AdvancedSetting

Get-AlarmActionNew-AlarmAction

Remove-AlarmActionGet-AlarmActionTrigger

New-AlarmActionTriggerRemove-AlarmActionTrigger

Get-AlarmDefinitionSet-AlarmDefinition

Get-AnnotationSet-Annotation

Get-CustomAttribute

New-CustomAttributeRemove-CustomAttribute

Set-CustomAttributeNew-Datastore

Remove-DatastoreGet-DatastoreSet-Datastore

Copy-DatastoreItemApply-DrsRecommendation

Get-DrsRecommendationGet-DrsRule

New-DrsRuleRemove-DrsRule

Set-DrsRuleGet-EsxCli

Get-EsxTopMove-FolderNew-FolderGet-Folder

Remove-FolderSet-Folder

Get-InventoryMove-Inventory

Remove-InventoryGet-NetworkAdapter

Get-TaskStop-TaskWait-Task

Get-VIAccountGet-View

Get-VIObjectByVIViewGet-VIPermission

New-VIPermissionRemove-VIPermission

Set-VIPermissionGet-VIPrivilege

New-VIPropertyRemove-VIProperty

Get-VIRoleNew-VIRole

Remove-VIRoleSet-VIRole

Connect-VIServerDisconnect-VIServer

Get-CIRoleGet-CIUser

Start-CIVAppImport-CIVApp

New-CIVAppRestart-CIVApp

Remove-CIVAppSet-CIVApp

Stop-CIVAppSuspend-CIVApp

Get-CIVApp

Stop-CIVAppGuestRestart-CIVAppGuest

Set-CIVAppNetworkGet-CIVAppNetwork

Remove-CIVAppNetworkNew-CIVAppNetworkSet-CIVAppStartRuleGet-CIVAppStartRule

Import-CIVAppTemplateRemove-CIVAppTemplate

Set-CIVAppTemplate

Get-CIVAppTemplateNew-CIVAppTemplateGet-CIViewStart-CIVMStop-CIVMRestart-CIVMGet-CIVMSuspend-CIVMStop-CIVMGuestRestart-CIVMGuestSearch-Cloud

Get-ExternalNetworkGet-Media

Get-NetworkPoolGet-Org

Remove-OrgSet-Org

New-OrgGet-OrgNetwork

Remove-OrgNetworkSet-OrgNetwork

New-OrgNetwork

New-OrgVdcRemove-OrgVdc

Set-OrgVdcGet-OrgVdc

Get-ProviderVdc

Connect to a depot:

Add-EsxSoftwareDepot https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml

Add a package by name to an image profile:

Add-EsxSoftwarePackage -ImageProfile "My custom profile" -SoftwarePackage net-bnx2

Clone an image profile, then add a package by name:

New-EsxImageProfile -CloneProfile "ESX-5.0-234567-standard" -Name "My custom profile" | Add-EsxSoftwarePackage net-bnx2

Export an ISO image

Export-EsxImageProfile -ImageProfile "Evan's Profile" -ExportToIso -FilePath c:\isos\evans-iso.iso

Clone an image profile, add a software package, then export to offline bundle.

New-EsxImageProfile -CloneProfile "ESXi-5.0.0-234567-standard" -Name "Evan's Profile"

Add-EsxSoftwarePackage -ImageProfile "Evan's Profile" -SoftwarePackage cisco-vem-v140

Export-EsxImageProfile -ImageProfile "Evan's Profile" -ExportToBundle -FilePath c:\isos\base-plus-vem.zip

Display all image profiles from depots and all image profiles the user created during this PowerCLI session:

Get-EsxImageProfile

List all the VIBs, sorted by date:

Get-EsxSoftwarePackage | Sort-Object ReleaseDate | Format-Table -Property Name,Version,Vendor

List all the VIBs from VMware and Cisco released after Jan 1, 2010:

Get-EsxSoftwarePackage -Vendor "VMware","Cisco" -ReleasedAfter 1/1/2010

List all the VIBs from vendors other than VMware

Get-EsxSoftwarePackage | ? {$_.Vendor -ne "VMware"}

Clone an image profile, give it a new name, and change the acceptance level.

New-EsxImageProfile -CloneProfile "ESX-5.0-234567-standard" -Name "My custom profile" -AcceptanceLevel CommunitySupported

Connect to a depot, then disconnect from it by URL.

Add-EsxSoftwareDepot https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml

Remove package foo from my custom profile:

Remove-EsxSoftwarePackage -ImageProfile "My custom profile" -SoftwarePackage foo

Modify the VIB list of an existing image profile

Set-EsxImageProfile -ImageProfile "Profile of a Fool" -SoftwarePackage esx-base,scsi-ips,esx-tboot

Image Builder

vCloud Tenant Operations

Get-PowerCLIVersionGet-Task

Get-VICredentialStoreItemImport-CIVAppTemplate

New-CIAccessControlRuleNew-CIVApp

New-CIVAppNetworkNew-CIVAppTemplate

New-VICredentialStoreItemRemove-CIAccessControlRule

Remove-CIVAppRemove-CIVAppNetwork

Remove-CIVAppTemplateRemove-VICredentialStoreItem

Restart-CIVAppRestart-CIVAppGuest

Restart-CIVMRestart-CIVMGuest

Search-CloudSet-CIAccessControlRule

Set-CINetworkAdapterSet-CIVApp

Set-CIVAppNetworkSet-CIVAppStartRuleSet-CIVAppTemplate

Set-OrgSet-PowerCLIConfiguration

Start-CIVApp

Start-CIVMStop-CIVApp

Stop-CIVAppGuestStop-CIVM

Stop-CIVMGuestStop-Task

Suspend-CIVAppSuspend-CIVM

Wait-Task

vCloudTenant

C

M

Y

CM

MY

CY

CMY

K

Managing VMware wi.pdf 1 8/7/12 10:33 AM