Issue polling SNMP on Hyper-V Servers via PowerShell


I work for an MSP and we are moving to a new dashboard environment, we would like to monitor SNMP checks on servers via PowerShell however we have an issue with Hyper-V servers where it seems it cannot create the object, therefore the SNMP checks fail as it is unable to poll.

So far we have discovered that Hyper-V servers do not have the .DLL file that this relies on (oleprn.dll), attempted to copy this .DLL from another server and register using regsvr32 but this failed, also tried running the script from a VM hosted on the server and point it at Hyper-V server (it can take IP address as an argument).

This is the part of the code that is failing: $snmp = New-Object -ComObject olePrn.OleSNMP

The script works fine on all other servers but this line generates the below error when running on Hyper-V servers

Expected behavior is that this object is created and then we use $snmp.get(oid goes here) to poll the device in question.

Actual result is the following error:

New-Object : Retrieving the COM class factory for component with CLSID {00000000-0000-0000-0000-000000000000} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)). At line:1 char:9 + $snmp = New-Object -ComObject olePrn.OleSNMP + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ResourceUnavailable: (:) [New-Object], COMException + FullyQualifiedErrorId : NoCOMClassIdentified,Microsoft.PowerShell.Commands.NewObjectCommand

asked on Stack Overflow Sep 20, 2019 by Tom Halverson

0 Answers

Nobody has answered this question yet.

User contributions licensed under CC BY-SA 3.0