Difference between revisions of "SNMP and PowerShell"

Jump to navigation Jump to search
559 bytes added ,  10:43, 10 October 2016
→‎Overview: Updated for v8 of library
(Minor typo fixes and PowerShell v3 Generic Objects compatability)
(→‎Overview: Updated for v8 of library)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{#widget:Widget:GoogleAdSenseSkyscraper}}
== Overview ==
== Overview ==
This page covers using PowerShell as an SNMP client, so that you can poll/probe/interrogate SNMP servers (be they servers, network devices, UPS's, etc).
This page covers using PowerShell as an SNMP client, so that you can poll/probe/interrogate SNMP servers (be they servers, network devices, UPS's, etc).
Line 7: Line 8:
You don't need to use /n's [http://www.powershellinside.com/powershell/netcmdlets/ NetCmdlets], or run the [http://www.net-snmp.org/ Net-SNMP] executables, as other examples on the web do.
You don't need to use /n's [http://www.powershellinside.com/powershell/netcmdlets/ NetCmdlets], or run the [http://www.net-snmp.org/ Net-SNMP] executables, as other examples on the web do.


In order to make the library available for PowerShell to use...
=== Installation ===
# Download the latest '''BigDipper''' binary (eg bigdipper_7.5_bin.zip) from http://sharpsnmplib.codeplex.com/releases/view/78947 and extract
In order to make the library available for PowerShell to use you need to have the .NET dll library file available for Powershell
# Go to http://sharpsnmplib.codeplex.com and browse to the '''Downloads''' tab
#* Current latest is v8 (TritonMate), later versions are available from [https://www.nuget.org Nuget]
# Download the latest binary (eg tritonmate_8.0_bin.zip from http://sharpsnmplib.codeplex.com/releases/view/79079) and extract
# Copy the <code>SharpSnmpLib.dll</code> file to somewhere you can find it
# Copy the <code>SharpSnmpLib.dll</code> file to somewhere you can find it
#* EG in a folder <code>/lib/LexTmSharpSNMP/</code> under where you run your scripts from
#* EG in a folder <code>/lib/LexTmSharpSNMP/</code> under where you run your scripts from
#* Note that you may need to Unblock the file (right-click and select '''Properties''' and look for '''Unblock''' towards bottom of Properties window)


'''Windows 2008 Server doesn't have .NET 3.5 or 4 installed by default''', therefore it needs to be installed.  To do so...
'''Windows 2008 Server doesn't have .NET 3.5 or 4 installed by default''', therefore it needs to be installed.  To do so...
Line 150: Line 155:


== Example Usage ==
== Example Usage ==
{| class="vwiki-boxout"
|-
| '''For further examples see - http://vblog.strutt.org.uk/tag/sharpsnmplib/'''
|}
If you saved the [[#Generic_Objects|Generic Objects]] workaround script, the SNMP DLL file, and the above functions in <code>lib</code> sub-folder to where your running your PowerShell from, then you could perform queries as follows...
If you saved the [[#Generic_Objects|Generic Objects]] workaround script, the SNMP DLL file, and the above functions in <code>lib</code> sub-folder to where your running your PowerShell from, then you could perform queries as follows...


Navigation menu