VMWARE VSPHERE POWERCLI INSTALLATION AND CONFIGURATION STEP BY STEP
I was configuring SNMP on multiple ESXi servers and I wanted to use only VMWare Powercli for this instead of Esxi SSH or vCLI commands, (I wanted avoid enabling SSH service and port on Esxi and didn't want to install vCLI tools, As I already have Powercli on my laptop, I can automate this task using PowerShell), In this blog I will show how to use one liner commands to configure SNMP. First thing open VMWare vSphere Powercli. and connect to vCenter server using Connect-VIServer vCenterserver Next create a connection to ESXi host using $esxcli = Get-VMHost EsxiServer | Get-Esxcli. This connection info is stored in $esxcli variable.
Now while configuring different version of ESXi I found there is a slight syntax difference between different Esxi Version. Below screenshot is for ESXi 5.1. First Command is $esxcli.system.snmp.get(), It shows the current SNMP configuration on that particular ESXi host we connected. In next esxcli command we will set SNMP server information on server.
$esxcli.system.snmp.set($null,'public',$true,$null,$null,$null,$null,'162',$null,$null,$null,$null,$null,'172.25.8.202/public',$null,$null)
There are 16 parameters in ESXi Version 5.1 and definition can be viewed using command $esxcli.system.snmp.set.Value.
Next fire once again $esxcli.system.snmp.get() to view modified configuration.
If you are using ESXi 5.5 version. There is one addition value (Total count is 17).
$esxcli.system.snmp.set($null,'public',$true,$null,$null,$null,$null,$null,'162',$null,$null,$null,$null,$null,'172.25.8.202/public',$null,$null)
I didn't check the same on ESXi version 6 but soon will post here.