lahell / snmpv3 Goto Github PK
View Code? Open in Web Editor NEWPowerShell Module for SNMPv3
License: MIT License
PowerShell Module for SNMPv3
License: MIT License
Exception calling "BulkWalk" with "11" argument(s): "Request timed out after 3000-ms."
At C:\Program Files\WindowsPowerShell\Modules\SNMPv3\1.1.2\Public\Invoke-SNMPv3Walk.ps1:139
char:5
[Lextm.SharpSnmpLib.Messaging.Messenger]::BulkWalk(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
It seems to work for short invokes, but I'm doing about 100+ invoke-snmpv3walk
SHould I be placing a pause in between the invokes?
Good day!
Faced with trouble walk or get oids like ipNetToMediaPhysAddress (1.3.6.1.2.1.4.22.1.2) expecting raw value data, but getting value like ?#?f?? that looks like ASCII encoding substitutes characters outside its valid range with a question mark "?"
For OctetString values containing plain text correct output is shown:
PS C:\Users\Administrator> Invoke-SNMPv3Walk @walkRequest -OID 1.3.6.1.2.1.31.1.1.1.1
Node OID Type Value
---- --- ---- -----
172.16.22.1 1.3.6.1.2.1.31.1.1.1.1.1 OctetString mgmt
172.16.22.1 1.3.6.1.2.1.31.1.1.1.1.2 OctetString ha
172.16.22.1 1.3.6.1.2.1.31.1.1.1.1.3 OctetString port1
But for OctetString values containing MAC addresses incorrect output is shown:
PS C:\Users\Administrator> Invoke-SNMPv3Walk @walkRequest -OID 1.3.6.1.2.1.4.22.1.2
Node OID Type Value
---- --- ---- -----
172.16.22.1 1.3.6.1.2.1.4.22.1.2.1.172.16.22.2 OctetString PV?�/
172.16.22.1 1.3.6.1.2.1.4.22.1.2.2.169.254.0.1 OctetString ?q.Bv4
PS C:\Users\Administrator> Invoke-SNMPv3Walk @walkRequest -OID 1.3.6.1.2.1.4.22.1.2
Node OID Type Value
---- --- ---- -----
172.16.22.4 1.3.6.1.2.1.4.22.1.2.78.172.16.22.1 OctetString � ��
172.16.22.4 1.3.6.1.2.1.4.22.1.2.78.172.16.22.2 OctetString PV?�/
Is it a bug or is it by design?
While using authentication, the second send of GetResponse just do exactly the same whereas this should set in parameters "msgAuthoritativeEngineBoots" and "msgAuthoritativeEngineTime".
The second send should use the last report, the one returned by the the first GetResponse.
So your code is good, there's just a little mistake.
At this line:
SNMPv3/SNMPv3/Public/Invoke-SNMPv3Get.ps1
Line 175 in 0917196
It should be "$Reply", not "$Report"
Since the reply has been identified as a Report:
SNMPv3/SNMPv3/Public/Invoke-SNMPv3Get.ps1
Line 149 in 0917196
Hello,
When polling a value, i often get an OctetString value back:
Node OID Type Value
---- --- ---- -----
11.11.11.11 1.3.6.1.4.1.45391.1.1.1.2.0 OctetString GA1049
When I try to overwrite that value, the OctetString type is not available in choices:
Trying to push that value as string does not yield any error, but the device does not change the value (although that OID is writable).
$siteid = [Lextm.SharpSnmpLib.OctetString]::new('XY999')
does not do the trick either.
Am I missing something? If not, would it be possible to add the OctetString type to the list?
Thanks :)
Is there anyway to record auth failures? Id like to script a conditional statement for handling failures or successes, but it doesnt seem this can be easily stored in a variable, and the "Warning message" that gets written to the console doesnt log an entry in $error. Any ideas?
PS C:\Users\me\Desktop>> $WalkRequest = @{
UserName = 'myuser
Target = '10.52.42.15'
OID = '1.3.6.1.2.1.1'
AuthType = 'SHA1'
AuthSecret = 'abcdefg
PrivType = 'AES128'
PrivSecret = 'hijklmnop'
}
Invoke-SNMPv3Walk @WalkRequest
Exception calling "GetResponse" with "2" argument(s): "Request timed out after 3000-ms."
At C:\Program Files\WindowsPowerShell\Modules\SNMPv3\1.1.2\Public\Invoke-SNMPv3Walk.ps1:135 char:5
+ $Report = $Discovery.GetResponse($Timeout, $IPEndPoint)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : TimeoutException
Exception calling "BulkWalk" with "11" argument(s): "Value cannot be null.
Parameter name: report"
At C:\Program Files\WindowsPowerShell\Modules\SNMPv3\1.1.2\Public\Invoke-SNMPv3Walk.ps1:139 char:5
+ [Lextm.SharpSnmpLib.Messaging.Messenger]::BulkWalk(
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ArgumentNullException
Whatever I do. Either walk or get the same "bulk" error appears.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.