You cannot call a method on a null-valued expression.
Closed this issue · 5 comments
Deleted user commented
Hello,
I am not workstation admin and as soon as I launch the script with the proper arguments, I'm getting flooded by the following error :
Exception calling "BlockCopy" with "5" argument(s): "Offset and length were out of bounds for the array or count is
greater than the number of elements from index to the end of the source collection."
At C:\Users\x\test\raw-socket-sniffer.ps1:103 char:5
+ [Buffer]::BlockCopy([BitConverter]::GetBytes($rc), 0, $buffer, 12 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ArgumentException
You cannot call a method on a null-valued expression.
Any idea what could cause this ?
stephenwvickers commented
Hi @flacostec
What version of Windows are you running this on?
Stev
Deleted user commented
Currently running Windows 10 1703 (15036.1324) and I am not administrator of the workstation (I've edited my answer).
stephenwvickers commented
Ah okay, so raw sockets on WIndows require administrator privileges (there's a note on this page).
Can you try using "Run as Administrator"? Just verified and it worked for me.
Steve
Deleted user commented
Worked fine with admin right. :-)
GirkovArpa commented
I have the same issue and running as Administrator with Admin PowerShell doesn't solve it.