Posts

Showing posts with the label Powershell

Powershell script to list percentage of VMs present

These are just basic powershell scripts. You can use your own logic to enhance this. #To list percentage of VMs present in each resource pool cls #Connect to Vcenter

Powershell script to list resource pools lesser than 'n' VMs

These are just basic powershell scripts. You can use your own logic to enhance this. #To list resource pools lesser than n vms cls #Connect to Vcenter

Powershell script to list VMs greater than 4 GB RAM

These are just basic powershell scripts. You can use your own logic to enhance this. #To list VMs greater than 'n' RAM cls #Connect to Vcenter

Powershell script to get status of VMs in a resource pool

These are just basic powershell scripts. You can use your own logic to enhance this. cls #Connect to Vcenter Connect-VIServer -Server 172.28.xx.xx -user username -Password password #Take input from the user $pool = Read-Host "Input the Resource pool name"  #Select the cluster from which the resource pool need to be selected. '*' represents all. Replace it with the resource pool name to be specific $rpools = Get-ResourcePool -Location * $vmpoff = $null  $vmpon =$null  #Select each resource pool from the cluster foreach($rpool in $rpools) { #Check if any resource pool name maches the user input  if($rpool -match $pool)     {    $pool = $rpool.Name     $vms = Get-VM -Location $rpool    Foreach($vm in $vms)       {       $vmp =$vm.PowerState       if($vmp -ne "PoweredOn")          {          [array]$vmpoff+= $vm          }       else           {          [array]$vmpon+= $vm          }       }    } }    Write-Host "

Powershell script to backup vApp machines using Veeam backup

These are just basic powershell scripts. You can use your own logic to enhance this. cls #Load vmware pssnapin if(!(Get-PSSnapin | ?{$_.Name -eq "VMware.VimAutomation.Core"})) {     Add-PSSnapin VMware.VimAutomation.Core }