Last active
June 18, 2025 03:44
-
-
Save hunzo/a158a1ccba748ade259f9a29c50ff847 to your computer and use it in GitHub Desktop.
enable-snmp by powershell script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install SNMP Feature | |
Install-WindowsFeature SNMP-Service -IncludeAllSubFeature -IncludeManagementTools | |
# Setting SNMP Service Start Automatic | |
Set-Service -Name SNMP -StartupType Automatic | |
Set-Service -Name SNMPTRAP -StartupType Automatic | |
Start-Service -Name SNMP | |
Start-Service -Name SNMPTRAP | |
# Seting SNMP Community (ex. public) | |
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\SNMP\Parameters\ValidCommunities" -Name "public" -PropertyType DWord -Value 4 -Force | |
# Create Key PermittedManagers (Allow All) | |
New-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Services\SNMP\Parameters\PermittedManagers" -Force | |
# Add Firewall Rule for SNMP UDP Port 161 | |
if (-not (Get-NetFirewallRule -DisplayName "Allow SNMP UDP 161" -ErrorAction SilentlyContinue)) { | |
New-NetFirewallRule -DisplayName "Allow SNMP UDP 161" ` | |
-Direction Inbound ` | |
-Protocol UDP ` | |
-LocalPort 161 ` | |
-Action Allow ` | |
-Profile Any ` | |
-Enabled True | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment