Quantcast
Channel: VMware Communities : Blog List - All Communities
Viewing all articles
Browse latest Browse all 3135

vSphere PowerCLI Commands

$
0
0

Get-Command | more : displays all Windows poweshell commands

 

 

 

Get-VICommand | Format-List | more : displays all Powercli commands

 

 

 

How to define a variable in PowerCLI

 

 

$VMHostname = "<Host_name@example.com>"

$Vcentername = "<Vcneter_name@example.com>"

$esxi1 = Get-VMHost $vmHost

 

 

 

 

 

How to connect to host

 

 

Connect-VIServer -Server $vmHostname -User root -Password <password>

 

 

to verify just type get-VmHost

 

 

 

To Disconnect

 

 

Disconnect-VIServer -Server $vmHostName

 

 

 

to connecct to Vcenter

 

 

Connect-VIServer -Server $vCenter -User root -Password <password>

 

 

 

 

 

 

 

some of the useful commands using the variable

 

 

$esxi1.Version : to get Esxi version

$esxi1.NumCPU : to get number of CCPU

$esxi1.CPUTotalMHz : to get CPu capacity

$esxil.MemoryTotalMB : to get memory capcity of host

$esxil.ProcessorType : to get the processor type of host

$esxil |get-datastore

 

Network commands

 

 

 

 

"List all of the virtual switches available on the ESXi host.

$esxi1 | Get-VirtualSwitch

 

 

List all port groups defined on the ESXi host.

$esxi1 | Get-VirtualSwitch | Get-VirtualPortgroup

List all virtual machine adapters and networks to which the adapters are connected.

Get-VM | Get-NetworkAdapter

 

 

Show the switch port usage of all virtual switches on the ESXi host.

$esxi1 | Get-VirtualSwitch | Measure-Object -sum numports*


Viewing all articles
Browse latest Browse all 3135

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>