VMware/PowerCLI Scripts

From DER's LLC
Revision as of 19:07, 2 June 2023 by Admin (talk | contribs) (Created page with "=PowerCLI Scripts= ===PowerCLI on MAC=== *Install Docker engine https://docs.docker.com/docker-for-mac/install/ https://docs.docker.com/engine/installation/linux/docker-ce/centos/ *Pull the powerclicore container docker pull vmware/powerclicore *Run the powerclicore container docker run --rm -it vmware/powerclicore ===Find the Total number of Virtual CPU's per vCenter Server=== Connect-VIServer -Server <VCENTER_SERVER> -Protocol https -User <ADMIN_USER> -Password...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

PowerCLI Scripts

PowerCLI on MAC

  • Install Docker engine
https://docs.docker.com/docker-for-mac/install/
https://docs.docker.com/engine/installation/linux/docker-ce/centos/
  • Pull the powerclicore container
docker pull vmware/powerclicore
  • Run the powerclicore container
docker run --rm -it vmware/powerclicore

Find the Total number of Virtual CPU's per vCenter Server

Connect-VIServer -Server <VCENTER_SERVER> -Protocol https -User <ADMIN_USER> -Password  <PASS>
$Total_vCPU = 0 
ForEach ($VM in (Get-VM)){
  If (($VM).PowerState -eq "PoweredOn"){
    $Total_vCPU += ($VM).NumCpu
  }
} 
Write-Host “Total number of Virtual CPU’s: “$Total_vCPU

Find the Total number of Physical CPU's per vCenter Server

Connect-VIServer -Server <VCENTER_SERVER> -Protocol https -User <ADMIN_USER> -Password  <PASS>
$Total_pCPU = 0
ForEach ($VMHOST in (Get-VMHOST)){
  If (($VMHOST).PowerState -eq "PoweredOn"){
    $Total_pCPU += ($VMHOST).NumCpu
  }
}
Write-Host “Total number of Physical CPU’s: “$Total_pCPU