Using UCS PowerTool To Set SNMP Configuration

Share on:

Time for more UCS Scripting! This time to enable SNMP. The script is pretty straightforward, but nice to have to easily set up SNMP across multiple UCS domains.

Pre-Requsites

Preparing to Execute the Script

The script is pretty straight forward, just need to define a few variables seen below and then you execute the script. I will walk you through the process.

 1#Define Variables
 2$cred = Get-Credential
 3$domains = "ucs01.lab.local","ucs02.lab.local"
 4$Descr = "SNMP config for UCS"
 5$AdminState = "enabled"
 6$SysContact = "[email protected]"
 7$SysLocation = "US"
 8$Community = "public"
 9
10#Cycles through each UCS setting values
11Foreach ($ucs in $domains) {
12  Connect-UCS $ucs -Credential $cred
13  $servers = Get-UCSRackUnit
14  Foreach ($server in $servers) {
15    Set-UcsSnmp -Descr $Descr -AdminState $AdminState -SysContact  $SysContact -SysLocation $SysLocation -Community $Community -force
16  }
17  Disconnect-UCS
18}

Execute the Script

  • Run .\Set-UcsSnmpConfiguration.ps1
comments powered by Disqus

See Also