Talk:SNMP and PowerShell

From vwiki
Revision as of 18:42, 30 July 2014 by Tysonflint (talk | contribs) (The SNMP.PS1 download is the same file as seen in the example under the name SNMP-Funcs.ps1)
Jump to navigation Jump to search

Question:

Hi there,

really useful info on getting PS to talk to SNMP, thanks.

One thing I can't figure out in your examples though:

PS C:\Users\simon\Documents\Scripts> . .\lib\SNMP-Funcs.ps1 What does this line do? I can't find any reference to a script called SNMP-Funcs.ps1 elsewhere in the article.

I've followed your steps and everything *seems* to be working except I get no output when running the "get" and "walk" scripts and I suspect the above line my be the culprit!

Thanks in advance,

I.



Response:

OK, I realize no one has responded in a year, but perhaps someone will find this info useful...

The author is just using a different file name called '. .\lib\SNMP-Funcs.ps1' in his example. It is the same as 'SNMP.ps1'

In the example below, BigDipper is my 'scripts' folder. I have a sub-folder under it called 'lib' with SNMP.ps1 in it and a sub-folder under 'lib' called 'LexTmSharpSNMP' with 'SharpSnmpLib.dll' in it:

.\lib\snmp.ps1

.\lib\LexTmSharpSNMP\SharpSnmpLib.dll

Example:

PS C:\users\tyson\Downloads\snmp\PowerShell\BigDipper> . .\lib\SNMP.ps1

PS C:\users\tyson\Downloads\snmp\PowerShell\BigDipper> Load-SnmpAssembly | fl

CodeBase  : file:///C:/users/tyson/Downloads/snmp/PowerShell/BigDipper/lib/LexTmSharpSNMP/SharpSnmpLib.dll EntryPoint  : EscapedCodeBase  : file:///C:/users/tyson/Downloads/snmp/PowerShell/BigDipper/lib/LexTmSharpSNMP/SharpSnmpLib.dll FullName  : SharpSnmpLib, Version=7.5.10510.1, Culture=neutral, PublicKeyToken=db32884da8b9d0dd GlobalAssemblyCache  : False HostContext  : 0 ImageFileMachine  : ImageRuntimeVersion  : v2.0.50727 Location  : C:\users\tyson\Downloads\snmp\PowerShell\BigDipper\lib\LexTmSharpSNMP\SharpSnmpLib.dll ManifestModule  : SharpSnmpLib.dll MetadataToken  : PortableExecutableKind : ReflectionOnly  : False


PS C:\users\tyson\Downloads\snmp\PowerShell\BigDipper> Invoke-SNMPget "192.168.1.154" ".1.3.6.1.4.1.318.1.1.4.4.2.1.3.1"

OID Data

--- ----

.1.3.6.1.4.1.318.1.1.4.4.2.1.3.1 1


PS C:\users\tyson\Downloads\snmp\PowerShell\BigDipper>

The Wiki is pulling all my spaces out of the output between the final OID and the Data fields. It's returning:

OID = .1.3.6.1.4.1.318.1.1.4.4.2.1.3.1

Data = 1