PoshCode Archive  Artifact [12f12160c9]

Artifact 12f12160c9d1879e42ed816a0333ce3a319620ce2cad37ef7bc5dca3d7607d5b:

  • File Get-SNMPHost.ps1 — part of check-in [12315a3fea] at 2018-06-10 12:56:30 on branch trunk — Gets the VMHostSnmp object for VMWare VI Toolkit consumption (user: unknown size: 661)

# 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
}