Skip to content

Instantly share code, notes, and snippets.

@gpduck
Last active April 9, 2017 20:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gpduck/fd4c2a14b56c18dcbfc0fa13662742a7 to your computer and use it in GitHub Desktop.
Save gpduck/fd4c2a14b56c18dcbfc0fa13662742a7 to your computer and use it in GitHub Desktop.
I made a wrapper for your .Net method calls so you can test...
[System.AppDomain]::CurrentDomain.GetAssemblies().ExportedTypes | %{
$Type = $_
$Type.GetMethods() | Select -Unique Name | %{
$Method = $_
$Name = "Invoke-{0}.{1}" -f $Type.Fullname, $Method.Name
@"
function $Name {
param(
[Parameter(Mandatory=`$True,ValueFromPipeline=`$True)]
`$InputObject,
[Object[]]`$Parameters
)
`$InputObject."$($Method.Name)"(`$Parameters)
}
"@
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment