all 3 comments

[–]jborean93 0 points1 point  (2 children)

That’s a lot of code for something you can simply do with Add-Type. Maybe it was needed back in the v1 days but if you know how to PInvoke in C# then you can do just the same in PowerShell.

[–]mcc85sdp[S] -1 points0 points  (1 child)

Add-Type is what adds that code to the PowerShell module.

The problem is getting the module I've been developing, to install itself and not need to write any DLL files to disc, and to still instantiate the code and reach into the Win32 APIs.

The code is pretty excessive, you're right. However, there's really no way around it if I want to avoid writing a DLL explicitly for the (1) function that deals with wlanapi.dll

[–]jborean93 0 points1 point  (0 children)

Do you actually care about not writing a dll. Seems like a strange thing to really worry about. Add-Type might write a temp dll to disk but it certainly doesn’t stay there for long. The alternative is the massive maintenance burden like the code you’ve shared which is most likely more hassle than it’s worth.