add-type -name user32 -namespace '' -memberDefinition ' [DllImport("user32.dll", CharSet=CharSet.Auto)] public static extern Int32 SendMessage( IntPtr hWnd, UInt32 msg, UIntPtr wParam, IntPtr lParam );'
user32
type, its (only) static
method SendMessage
can be invoked like so: [user32]::SendMessage(…)
SendMessage(HWND_BROADCAST, WM_SETTINGCHANGE, 0, "Environment")
after changing a value in the registry in HKEY_CURRENT_USER\Environment
.