"Vmware Powercli 5v1 Cheat Sheet"

ADVERTISEMENT
ADVERTISEMENT

Download "Vmware Powercli 5v1 Cheat Sheet"

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