VM disk space usage
[math]::Round(((get-vm | Where-object{$_.PowerState -eq "PoweredOn" }).UsedSpaceGB | measure-Object -Sum).Sum)
Check VM and VMtools level
get-vm | where-object {$_.GuestFullName -like “*Linux*”} | select Name,GuestFullName,ToolsVersionStatus,ToolsVersion | FT -a
Check VM and VMtools level and include the Ones that require tools only
get-vm | where-object {$_.GuestFullName -like “*Linux*” -and $_.ToolsVersionStatus -eq "guestToolsNotInstalled"} | select Name,GuestFullName,ToolsVersionStatus,ToolsVersion | FT -a
VMs on Host with More than 2vCPU & 8GB Ram
get-vm | Where-Object {$_.NumCpu -gt "2" -and $_.MemoryGB -gt "8"} | select N ame, NumCpu, MemoryGB, VMHost | Sort-Object NumCpu | ft -AutoSize
Network Adapter and VMs Connected to it
Get-Cluster "UK- IHateSpurs-01" | Get-VM | Get-NetworkAdapter | Where {$_.NetworkName -match "UAT_DMZ" } | Select Parent, Name, Type, NetworkName, MacAddress | ft –a
Get-VM or VMhost LOGS
(Get-Log -VMHost (Get-VMHost IHateSpurs-01*) vmkernel).Entries | Where {$_ -like “*WARNING*“}
(Get-Log -VMHost (Get-VMHost IHateSpurs-01*) hostd).Entries | Where {$_ -like “*WARNING*“}
(Get-Log -VMHost (Get-VMHost IHateSpurs-01*) vpxa).Entries | Where {$_ -like “*WARNING*“}
HOSTD The vmware-hostd management service is the main communication channel between ESX/ESXi hosts and VMkernel
In ESX you have only hostd and (if you have vCenter) vpxa.
These are daemon (services) for remote management:
hostd is used to remote management using VIC
vpxa is used by vCenter (the vpxd part of vCenter) to remote manament
VPXA It acts as an intermediary between VC and hostd. The vCenter Server Agent,
VMs with Snaphot
Get-VM | Get-Snapshot | Select VM,Name,Description,@{Label="Size";Expression={"{0:N2} GB" -f ($_.SizeGB)}},Created | FT -a
Snapshot Report to CSV
$VIServer="ron-vc01. IHateSpurs.local"
If (-not (Get-PSSnapin VMware.VimAutomation.Core))
{ Try { Add-PSSnapin VMware.VimAutomation.Core -ErrorAction Stop }
Catch { Write-Host "Unable to load PowerCLI, is it installed?" -ForegroundColor Red; Break }
}
Connect-VIServer $VIServer -Credential (Get-Credential) | Out-Null
Get-VM | Get-Snapshot | Select VM,Name,Description,@{Label="Size";Expression={"{0:N2} GB" -f ($_.SizeGB)}},Created | Export-Csv C:\scripts\csv\snapshotreport.csv
## VM disk space usage
[math]::Round(((get-vm | Where-object{$_.PowerState -eq "PoweredOn" }).UsedSpaceGB | measure-Object -Sum).Sum)
## Check VM and VMtools level
get-vm | where-object {$_.GuestFullName -like “*Linux*”} | select Name,GuestFullName,ToolsVersionStatus,ToolsVersion | FT -a
## Check VM and VMtools level and include the Ones that require tools only
get-vm | where-object {$_.GuestFullName -like “*Linux*” -and $_.ToolsVersionStatus -eq "guestToolsNotInstalled"} | select Name,GuestFullName,ToolsVersionStatus,ToolsVersion | FT -a
## VMs on Host with More than 2vCPU & 8GB Ram
get-vm | Where-Object {$_.NumCpu -gt "2" -and $_.MemoryGB -gt "8"} | select N ame, NumCpu, MemoryGB, VMHost | Sort-Object NumCpu | ft -AutoSize
## Network Adapter and VMs Connected to it
Get-Cluster "UK- IHateSpurs-01" | Get-VM | Get-NetworkAdapter | Where {$_.NetworkName -match "UAT_DMZ" } | Select Parent, Name, Type, NetworkName, MacAddress | ft –a
## Get-VM or VMhost LOGS
(Get-Log -VMHost (Get-VMHost IHateSpurs-01*) vmkernel).Entries | Where {$_ -like “*WARNING*“}
(Get-Log -VMHost (Get-VMHost IHateSpurs-01*) hostd).Entries | Where {$_ -like “*WARNING*“}
(Get-Log -VMHost (Get-VMHost IHateSpurs-01*) vpxa).Entries | Where {$_ -like “*WARNING*“}
HOSTD The vmware-hostd management service is the main communication channel between ESX/ESXi hosts and VMkernel
In ESX you have only hostd and (if you have vCenter) vpxa.
These are daemon (services) for remote management:
• hostd is used to remote management using VIC
• vpxa is used by vCenter (the vpxd part of vCenter) to remote manament
VPXA It acts as an intermediary between VC and hostd. The vCenter Server Agent,
## VMs with Snaphot
Get-VM | Get-Snapshot | Select VM,Name,Description,@{Label="Size";Expression={"{0:N2} GB" -f ($_.SizeGB)}},Created | FT -a
Snapshot Report to CSV
$VIServer="ron-vc01. IHateSpurs.local"
If (-not (Get-PSSnapin VMware.VimAutomation.Core))
{ Try { Add-PSSnapin VMware.VimAutomation.Core -ErrorAction Stop }
Catch { Write-Host "Unable to load PowerCLI, is it installed?" -ForegroundColor Red; Break }
}
Connect-VIServer $VIServer -Credential (Get-Credential) | Out-Null
Get-VM | Get-Snapshot | Select VM,Name,Description,@{Label="Size";Expression={"{0:N2} GB" -f ($_.SizeGB)}},Created | Export-Csv C:\scripts\csv\snapshotreport.csv