Use LEFT and RIGHT arrow keys to navigate between flashcards;
Use UP and DOWN arrow keys to flip the card;
H to show hint;
A reads text to speech;
7 Cards in this Set
- Front
- Back
Use basic and advanced cmdlets to manage VMs and ESXi Hosts: Connect to vCenter
|
PowerCLI Users' Guide, page 26
Connect to vCenter with: connect-viserver $vcenterservername |
|
Use basic and advanced cmdlets to manage VMs and ESXi Hosts: Retrieve and utilize information about VMs and Hosts
|
PowerCLI Users' Guide, page 26
You can retrieve information about the VMs and hosts by using the two basic commands "Get-VM" and "Get-VMHost" Example: Get-VM -Location ResourcePool01 Will return a list of all VMs in ResourcePool01 Get-VM is the cmdlet -Location is the parameter ResoucePool01 is the value |
|
Use basic and advanced cmdlets to manage VMs and ESXi Hosts: Using output redirection
|
PowerCLI Users' Guide, page 26
Information from one cmdlet can be redirectedto another cmdlet via use of the redirection/pipe operator "|" Example: Get-VM -Location ResourcePool01 | Set-VM -MemoryGB 2 -NumCPU2 This command uses the Get-VM cmdlet to return all VMs in ResourcePool001; it then redirects the output to the cmdlet Set-VM. Set-VM uses the list of VMs, and the parameter MemoryGB and value "2" to set the memory of all VMs to 2 GB; it also uses the NumCPU parameter and the value "2" to set the CPU count of all VMs to 2. |
|
Use basic and advanced cmdlets to manage VMs and ESXi Hosts: Multiple operations on a single line
|
PowerCLI Users' Guide, page 26
You can also run multiple operations on a single cmdlet, through the use of parameters. Example: Set-VM $vm -Name "Web Server" -GuestID winNetStandardGuest -Description "Company's web server" This command uses the cmdlet Set-VM and the variable $vm to set the name, guest ID, and description of the virtual machine specified in the variable. |
|
Use basic and advanced cmdlets to manage VMs and ESXi Hosts: Manage VM hosts
|
PowerCLI Users' Guide, page 27
vSphere PowerCLI/PowerShell can also be used to manage host Example: Set-VMHost -VMHost Host -State "Disconnected" This command resets the state of the Host to disconnected. In this example, Set-VMHost is the cmdlet. -VMHost is a parameter and it takes the Host as a value -State is a parameter and it takes the value "Disconnected" These two parameters/value pairs tell the cmdlet to set the Host value to disconnected. |
|
Use Web Service Access cmdlets
|
Get-View -viewtype “VirtualMachine”
Returns the vSphere .Net view objects of all the virtual machines $view=Get-View -viewtype “VirtualMachine” Get-VIObjectByVIView $view Stores the previous example’s result in the variable $view, then converts it back to the standard PowerShell VIObject |
|
Use Datastore and Inventory Providers
|
PowerCLI Guide, page 47
The Datastore and Inventory providers allow you to browse the default datastore drives. Using the cmdlet Get-PSDrive, you should see two PSDrives lists, vmstore and vmstores vmstore is the last connected vCenter Server, and VMstores is the currently connected vCenter Server PSDrives are great because they operate much like on would navigate an operating system via command line. Example: get-psdrive cd vmstore dir |