The below PowerShell script will check if SNMP is installed, if it is not installed it will install the service and configure it.

#!powershell

# Setup Key Values
###################################
## Security Tab
$managers = @("localhost","mgt1.knowledgeascent.com")
$ReadOnlyCommunities = @("public")
$ReadWriteCommunities = @("publicrw")

## Agent Tab
$sysContact = "SNMPAdmin@knowledgeascent.com"
$sysLocation = "KA Data Center"
$sysServices = "79"

## Traps Tab
$communityname = "public"
$trapdestination = @("localhost")

## Additional Variables
$server = $env:computername

##############################################
# Installing SNMP Services #
##############################################

Import-Module ServerManager
write-host " " -ForegroundColor Green
Write-host "Enabling ServerManager to check SNMP" -ForegroundColor Green
write-host "=====================================" -ForegroundColor Green

# Check if SNMP-Service is already installed
write-host " " -ForegroundColor Green
Write-host "Checking to see if SNMP service is installed…" -ForegroundColor Green
$SNMPCheck = Get-WindowsFeature -Name SNMP-Service

#
If ($SNMPCheck.Installed -ne "True")

Else

if ($SNMPCheck.Installed -eq "True")

Else