Skip to content

Instantly share code, notes, and snippets.

@benpturner
Last active November 8, 2020 20:23
Show Gist options
  • Save benpturner/de83882d6cef3019ad8cc1cdb6e722f0 to your computer and use it in GitHub Desktop.
Save benpturner/de83882d6cef3019ad8cc1cdb6e722f0 to your computer and use it in GitHub Desktop.
Load & Execute C# Module in PS
# Load C# Module in PS
[System.Reflection.Assembly]::LoadFile("C:\Temp\StandIn.exe")
# Load C# Module in PS from Base64 Blob
$dllbytes = [System.Convert]::FromBase64String("fdsfdsfds")
[System.Reflection.Assembly]::Load($dllbytes)
# Execute C# Module in PS
$Mods=[System.AppDomain]::CurrentDomain.GetAssemblies()
foreach ($Mod in $Mods){if ($Mod.FullName -like "StandIn*") {$Mod.EntryPoint.Invoke($null,@(,[string[]]@(""))) }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment