
$MyScriptPath = $This.MyScriptPath #Used to find proper path during click event $MenuItem | Add-Member -Name MyScriptPath -Value $MyScriptPath -MemberType NoteProperty By loading these DLLs into memory you are exposing certain parts of the API, this allows you to use them in the context of your PowerShell script: The two methods you need to load into context are GetConsoleWindow and ShowWindow. To do this, you’ll use some C# as you’ll see below. When a script is executed, you can toggle the PowerShell console window showing or not using a little. Since the menu items in the PowerShell form you’ll create will launch scripts, you should ensure the console doesn’t up. Unless hidden, when you launch a PowerShell script, the familiar PowerShell console will come up.

These functions will serve as a foundation for later use to make your life much easier as you will learn a bit later in this article. Open up your favorite PowerShell script editor and let’s get started!įor this project you are going to build three functions: two functions to show/hide the console to provide a cleaner user experience and one to add items to your systray menu. MenuItem – Individual objects for each option within the right-click menu.

VISUAL STUDIO MENUSTRIP MDI WINDOW LIST ITEM WINDOWS

Windows PowerShell 3 or later – The latest version of.Before you dive in, please be sure you meet the following minimum requirements:
