PowerCLI - How to get cluster resource information
Get cluster available resources and usage
Get-Cluster -Name ClusterName | get-vmhost | select Name, NumCpu, CpuUsageMhz, CPUTotalMhz, MemoryUsageGB, MemoryTotalGB | Export-Csv -NoTypeInformation -UseCulture -Path c:\test\vent1.csv
Get all datastores per cluster
foreach ($cluster in Get-Cluster){Add-content fi $cluster.Name; Get-cluster -name $cluster.Name | Get-Datastore | select Name, FreeSpaceGB, CapacityGB}
Get all datastores per cluster and export to txt file
foreach ($cluster in Get-Cluster){Add-content "C:\test\test.txt" "$cluster"; Add-Content "C:\test\test.txt" "Name, FreeSpaceGB, CapacityGB"; $d=Get-cluster -name $cluster.Name | Get-Datastore | select Name, FreeSpaceGB, CapacityGB; $d | % {add-content "c:\test\test.txt" "$($_.Name), $($_.FreeSpaceGB), $($_.CapacityGB)"}}
Get count of all hosts cpu cores
Get-Cluster -Name SharedEnterprisePlus01 | Get-VMHost | Measure-Object -Property NumCpu -Sum | select -ExpandProperty Sum
Get list of all NOT empty resource pools in the cluster based on pool's VM's cpu count
$ResourcePools = Get-Cluster -Name ClusterName | Get-ResourcePool
foreach ($Pool in $ResourcePools){$a = Get-ResourcePool -Name $Pool.Name | Get-VM | Measure-Object -Property NumCpu -Sum | select -ExpandProperty Sum; if($a -gt 0) {$Pool.Name}}
Get list of all VMs which have "prod" in their name and summary information about disk size
$a = get-vm | where{$_.Name -like "*prod*"}; foreach ($v in $a) {Write-Host $v.Name; Get-HardDisk -vm $v.name | Measure-Object -Property CapacityGB -Sum | select -ExpandProperty Sum}
Get list of all VMs which have "prod" in their name and summary information about disk size and write to txt file. I've used Write-Host commands to display output on the screen too.
$a = get-vm; foreach ($v in $a) {$s = Get-HardDisk -vm $v.name | Measure-Object -Property CapacityGB -Sum | select -ExpandProperty Sum; $s | %{Add-Content "d:\iso\vm.txt" "$($v.Name), $($_)"}; Write-Host $v.Name; Write-Host $s}
Tuesday, 14 July 2015
Friday, 10 July 2015
PowerCLI – How to get Vmware tools version
Get vmtools version for all VMs
get-vm | % {get-view $_.id} | select Name,@{Name="Tools Version"; Expression={$_.Config.tools.toolsversion}}, @{ Name="Tool Status"; Expression={$_.Guest.ToolsVersionStatus}}
Get vmtools version for all VMs from a cluster
get-cluster -Name ClusterName | get-vm | % {get-view $_.id} | select Name, @{Name="Tools Version"; Expression={$_.Config.tools.toolsversion}}, @{ Name="Tool Status"; Expression={$_.Guest.ToolsVersionStatus}}
Get vmtools version for all powered on VMs
get-vm | where {$_.powerstate -eq "PoweredOn"} | % {get-view $_.id} | select Name, @{Name="Tools Version"; Expression={$_.Config.tools.toolsversion}}, @{ Name="Tool Status"; Expression={$_.Guest.ToolsVersionStatus}}
List all VMs with out of date vmtools
get-vm | where {$_.Guest.ToolsVersionStatus -ne "guestToolsCurrent"} | % {get-view $_.id} | select Name, @{Name="Tools Version"; Expression={$_.Config.tools.toolsversion}}, @{ Name="Tool Status"; Expression={$_.Guest.ToolsVersionStatus}}
Get vmtools for all VMs with Microsoft operating system
get-cluster -Name ClusterName | get-vm | % {get-view $_.id} | where {$_.config.guestfullname -like "*Microsoft*"} | select Name, @{Name="OS Version"; Expression={$_.config.guestfullname}}, @{Name="Tools Version"; Expression={$_.Config.tools.toolsversion}}, @{Name="Tools Status"; Expression={$_.Guest.ToolsVersionStatus2}}
Get vmtools version for all VMs exported to csv file
get-vm | % {get-view $_.id} | select Name, @{Name="Tools Version"; Expression={$_.Config.tools.toolsversion}}, @{ Name="Tool Status"; Expression={$_.Guest.ToolsVersionStatus}} | Export-Csv -NoTypeInformation -UseCulture -Path C:\Tools\ToolsVersion.csv
Get vmtools version for all VMs
get-vm | % {get-view $_.id} | select Name,@{Name="Tools Version"; Expression={$_.Config.tools.toolsversion}}, @{ Name="Tool Status"; Expression={$_.Guest.ToolsVersionStatus}}
Get vmtools version for all VMs from a cluster
get-cluster -Name ClusterName | get-vm | % {get-view $_.id} | select Name, @{Name="Tools Version"; Expression={$_.Config.tools.toolsversion}}, @{ Name="Tool Status"; Expression={$_.Guest.ToolsVersionStatus}}
Get vmtools version for all powered on VMs
get-vm | where {$_.powerstate -eq "PoweredOn"} | % {get-view $_.id} | select Name, @{Name="Tools Version"; Expression={$_.Config.tools.toolsversion}}, @{ Name="Tool Status"; Expression={$_.Guest.ToolsVersionStatus}}
List all VMs with out of date vmtools
get-vm | where {$_.Guest.ToolsVersionStatus -ne "guestToolsCurrent"} | % {get-view $_.id} | select Name, @{Name="Tools Version"; Expression={$_.Config.tools.toolsversion}}, @{ Name="Tool Status"; Expression={$_.Guest.ToolsVersionStatus}}
Get vmtools for all VMs with Microsoft operating system
get-cluster -Name ClusterName | get-vm | % {get-view $_.id} | where {$_.config.guestfullname -like "*Microsoft*"} | select Name, @{Name="OS Version"; Expression={$_.config.guestfullname}}, @{Name="Tools Version"; Expression={$_.Config.tools.toolsversion}}, @{Name="Tools Status"; Expression={$_.Guest.ToolsVersionStatus2}}
Get vmtools version for all VMs exported to csv file
get-vm | % {get-view $_.id} | select Name, @{Name="Tools Version"; Expression={$_.Config.tools.toolsversion}}, @{ Name="Tool Status"; Expression={$_.Guest.ToolsVersionStatus}} | Export-Csv -NoTypeInformation -UseCulture -Path C:\Tools\ToolsVersion.csv
How to register Avamar VMware Proxy with Avamar
Step 1 (optional):
Set the new Proxy hostname
Step 2:
Register the Proxy with Avamar
Step 1 (optional):
Set the new Proxy hostname
- Log into the proxy via ssh using putty. Username root, password avam@r
- Run this script . /opt/vmware/share/vami/vami_set_hostname proxy_name (where proxy_name is the name you want to give to the proxy.
- Then vi the file /opt/vmware/share/vami/vami_set_hostname and look for the variable: HOSTNAME="localhost.localdom"
- Change the "localhost.localdom" to the name you gave the proxy in step 2
- Reboot the proxy
- Add VM Proxy name and IP address to the host file:/etc/hosts
Step 2:
Register the Proxy with Avamar
- Log in as user root and default password – avam@r (if not changed)
- Run the command /usr/local/avamarclient/etc/initproxyappliance.sh –start
- Provide the Avamar FQDN
- Provide the domain to register the proxy
- Type the new Avamar Software root password different from default value.
Subscribe to:
Posts (Atom)