# encoding: ascii
# api: powershell
# title: Get-SNMPHost.ps1
# description: Gets the VMHostSnmp object for VMWare VI Toolkit consumption
# version: 0.1
# license: CC0
# x-poshcode-id: 1132
# x-archived: 2009-05-31T07:47:24
#
#
Param($VC,$ESXCreds=(Get-Credential))

Write-Host "Connecting to VC to get ESX Hosts"
Connect-VIServer $VC | out-null

$ESXHosts = Get-VMHost

foreach($esxhost in $ESXHosts)
{
   Write-Host " Connecting to $esxhost"
   Connect-VIServer $esxhost.name -cred $ESXCreds | out-null
   $SNMPHost = Get-VMHostSnmp
   $SNMPHost | Add-Member -MemberType NoteProperty -Name ESXHost -Value $esxhost.name
   $SNMPHost
}
