How to change default SNMP port on Windows and Windows Server

Windows and Windows Server use SNMP for monitoring purposes. Check how to change the default SNMP (UDP 161) and SNMP Traps (UDP 162) ports by changing service settings.

If you follow my work, you could see that I work a lot with Windows and SNMP. For the folks who are not familiar, SNMP stands for for Simple Network Management Protocol. It is used for monitoring target network devices. Windows and Windows Servers support them for the last 20 years. You can get different metrics, from system uptime, CPU load, disk space to Windows service status.

SNMP uses the UDP port 161 for general SNMP messages. It uses UDP port 162 for SNMP Traps.

In this article, I will show you how to change the default support on Windows and Windows Servers. The procedure is applicable from Windows 7 to Windows 11, and from Windows Server 2012 to Windows Server 2022.

Regardless of what operating system and edition you are running: An administrator account is required.

Windows and Windows Servers with GUI

This procedure includes all operating system that provides you with Desktop experience. That includes the following operating systems:

  • Windows 7, 8, 8.1, 10 and 11
  • Windows Server 2012, 2012 R2, 2016, 2019 and 2022

Let’s do it together.

  1. Press Windows logo + R.
  2. Type the UNC below and press Enter. This will automatically opens File Explorer or Windows Explorer (in older OS).
%systemroot%\System32\Drivers\Etc
  1. Right-click on file services and open it in the text editor. I use Notepad++, but you can use any other text editor (Sublime Text, native Notepad, etc.).
  2. Navigate to lines 67 and 68. You should find there snmp and snmptraps.
Change default SNMP and SNMP Traps ports
  1. Change the port and save the file (File > Save).
  2. Press Windows logo + R. 
  3. Type services.msc and press Enter to open Services tool.
  4. Navigate to SNMP, and then right click on it and then click Restart.
  5. You have successfully changed default port and restarted your SNMP service. 
  6. Configure SNMP port on your NMS (Network Monitoring Solution) and start monitoring. 

Window Server Core and Hyper-V Server Core

As there is no Desktop experience with Server Core editions, you will need to make changes using PowerShell. This procedure is applicable to the following systems:

  • Windows Server Core 2012, 2012 R2, 2016, 2019 and 2022
  • Hyper-V Server Core 2012, 2012 R2, 2016 and 2019

Let’s do it together.

  1. Open PowerShell. You can do it by pressing 15 and then Enter.
Windows Server Core 2022
  1. Type notepad.exe and press Enter to open Notepad text editor.
  2. Click on File > Open and navigate to Windows\System32\Drivers\etc.
  3. Under File of types select All Files, and then select Services.
  1. Click Open to open services in Notepad.
  2. Navigate to snmp and snmptrap
  1. Change the port and save the file (File > Save).
  2. Close Notepad.
  3. Go back to PowerShell and reset the SNMP services by running the following command.
PS> Restart-Service SNMP
PS> Restart-Service SNMPTRAP
  1. You have successfully changed default port and restarted your SNMP service. 
  2. Configure SNMP port on your NMS (Network Monitoring Solution) and start monitoring. 

I hope you found this article helpful. If so, feel free to share it with your friends and connections using social media button(s) below. Thank you.

Leave a Reply

Your email address will not be published. Required fields are marked *

Share via
Copy link