Skip to content

Instantly share code, notes, and snippets.

View franklesniak's full-sized avatar

Frank Lesniak franklesniak

View GitHub Profile
@franklesniak
franklesniak / CheckDHCPOptions.ps1
Created November 2, 2015 04:44
I was hoping to use reflection to invoke the native DhcpRequestParams function, but I am getting an error: Exception calling "LoadFile" with "1" argument(s): "The module was expected to contain an assembly manifest.
##############################################################################
##
## Invoke-WindowsApi.ps1
##
## Invoke a native Windows API call that takes and returns simple data types.
##
## ie:
##
##
## Prepare the parameter types and parameters for the
@franklesniak
franklesniak / gist:6f208d9458be5f1f8c77
Created August 3, 2015 15:25
This script reproduces a problem with PowerShell v4 when KB3000850 is installed, and with PowerShell v5. It causes the interpreter to freeze / deadlock / spinlock / something that causes it to be unresponsive with high CPU
# This script should be dot-sourced or copied and pasted into the interpreter.
# This script reproduces a problem with PowerShell v4 when KB3000850 is installed, and with PowerShell v5.
# It causes the interpreter to freeze / deadlock / spinlock / something that causes it to be unresponsive with high CPU
# See also: https://gist.github.com/anonymous/572f42ba0ea7eec4f721#file-psclass_repro_reduced11-ps1
function __PSClass-InvokeScript($class, $script, $object) {}
function __PSClass-InvokePropertyMethod($Class, $PropertyType, $PropertyName, $instance) {
# Interestingly, if you comment-out the following line, the script exhibits the high CPU behavior but does *eventually* complete!