πŸ“œWin32 API Execution

Powershell

Add-Type

$User32 = @"
using System;
using System.Runtime.InteropServices;
public class User32 {
 [DllImport("user32.dll", CharSet=CharSet.Auto)]
 public static extern int MessageBox(IntPtr hWnd, String text, String caption, int
options);
}
"@
Add-Type $User32
[User32]::MessageBox(0, "This is an alert", "MyBox", 0)

Dynamic Invocation - UnsafeNativeMethods

Last updated

Was this helpful?