pinvoke icon indicating copy to clipboard operation
pinvoke copied to clipboard

PowerShell module containing all the PInvoke signatures published by Microsoft.

P\Invoke

PowerShell library that includes all the P\Invoke assemblies from Microsoft. P\Invoke is method for calling native functions in .NET. The P\Invoke assemblies are generated based on the latest version of the Windows API.

Install

Install the module from the PowerShell Gallery.

Install-Module Pinvoke

Use

Call native functions directly in PowerShell.

[PInvoke.Kernel32Dll]::LoadLibrary('myDll.dll')

Cmdlets

  • Get-Window
  • Remove-Window

Find a Window and Close it

$Process = Start-Process Notepad -PassThru
Get-Window -Hwnd $Process.MainWindowHandle | Remove-Window