r/PowerShell • • Apr 28 '26

snmp commandlet documentation

I'm a bit confused by the gaps in snmp documentation, for all languages and the entire stack itself, so I figured, hey Powershell will be easier than C++. But it seems it's just not. I read amongst others this posthttps://vwiki.co.uk/SNMP_and_PowerShell , and it's still clear as mud, how do docs for the "open" function $SNMP.open($IPAddresses[1], "public", 2, 3000) What on earth is 2 ? 3000 is as far I can figure a timeout, but where are the Powershell docs? I call Get, and I just get an error

> $SNMP.Get(".1.3.6.1.2.1.2.1")
Unknown Error
At line:1 char:1
+ $SNMP.Get(".1.3.6.1.2.1.2.1")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (:) [], COMException
    + FullyQualifiedErrorId : System.Runtime.InteropServices.COMException

I'm querying my local interface I assume, and it's all guesswork as to what that error means because I was expecting an interface ID back, a simple number?

4 Upvotes

25 comments sorted by

View all comments

Show parent comment

1

u/zaphodikus Apr 30 '26 edited Apr 30 '26

Microsoft drivers/agents for V3 are somehow hard to find. I am wanting to monitor a windows server/host. I would have to use WMI (another rabbit hole) and thus write 2 interfaces. Hence keen to not duplciate, but it may in the enc be easier to learn to use snmp , just enough, merely as a way to control and turn off ports on some intelligent switches that the kit hooks into. Very little of this is obvious in the older docs I started off with.

datadog I know about, but it's not my thing. I'm a test engineer in the embedded space, so I'm wanting to use snmp (or something) for 2 purposes.

  1. To collect outbound traffic speed/throughput only on a windows or linux box. Using C++ as it's a small batch-based and time-based capture. I'm also entertaining use of Wireshark pcap for this.
  2. To turn ports on a managed switch on and off or really just set up a vlan hard-switch-box type thing - I have found some python modules that seem to do this, but snmp is also an option

So no, network management is not my bag, but I'm hoping I can find one tool that maybe reduces the number of tools I have to pick up.

1

u/itasteawesome Apr 30 '26

If the target is a Windows server you should be speaking to it via WMI/WinRM, being dependent on SNMP for Windows is a weird niche that you almost never see in serious corporate environments.
No sane professional neteng allows snmp write operations on their network, I've been consulting in this space for 15 years across nearly 1000 companies and i've seen it in use twice.

1

u/zaphodikus Apr 30 '26

Wow. I think i explained already, I also need Linux support, and no its not an enterprise app, I just want one or two data points, which i can also get via the winperf api anyway. I'm merely looking for something cross platform, not to be lectured about 1000 companies that used it twice.

I do not think write access security is a large problem, since the target managed switches are airgapped anyway. That is part of my entire use case , tk have no external lan and wan traffic at all. And why i'm not too fussed about security, but it's still a pity that snmp is going to cause valid security questions to be raised anyway. The biggest problem is packaging it all up in the future. So fewer 3rd party dependencies the better. Which makes winrm and the linux proc filesystem the best way, but double work.