Powershell: SNMP CONFIGURATION AND TRAP

SNMP CONFIGURATION

Import-Module ServerManager
$check = Get-WindowsFeature | Where-Object {$_.Name -eq "SNMP-Services"}
If ($check.Installed -ne "True") {
Install-WindowsFeature -Name 'SNMP-Service','RSAT-SNMP'
}

New-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Services\SNMP\Parameters\ValidCommunities -Name PUGAZH -Value 8 -PropertyType "Dword" -Force
New-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\services\SNMP\Parameters\PermittedManagers -Name "PUGAZH" -Value 10.10.05.111 -PropertyType "String" -Force
New-Item -Path HKLM:\SYSTEM\CurrentControlSet\Services\SNMP\Parameters\TrapConfiguration -Name PUGAZH -Force
New-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Services\SNMP\Parameters\TrapConfiguration\PUGAZH -Name pugazh -Value 10.10.05.111

#Selecting the NIC and adding route based on IP range.
$MGMT = Get-NetIPAddress | ?{ $_.AddressFamily -eq "IPv4" -and ($_.IPAddress -match "10.10")} #| Select-Object InterfaceAlias
$gateway = $MGMT.IPAddress -replace "\d{1,3}$","1"
Rename-NetAdapter -Name $MGMT.InterfaceAlias -NewName Wi-Fi
New-NetRoute -DestinationPrefix "10.10.05.111/32" -InterfaceIndex $MGMT.InterfaceIndex -NextHop $gateway

Comments

Popular posts from this blog

altiris software key

Service Principal Names (SPNs) SetSPN Syntax (Setspn.exe)

Troubleshooting Netlogon Error Codes