Out-GridView is a great tool for quickly creating selection dialogs or displaying information that you sort. However, when using it in Visual Studio Code (VS Code), it tends to display the grid window behind the VS Code window. So, in an effort to prevent me from having to click my mouse one more time, I created the function Out-GridViewCode. This function uses all the parameters as the standard Out-GridView, just add some extra functionality to ensure the grid window is the active one. When using the Out-GridView it will automatically bring the grid windows to the front. If you use the -PassThru or -Wait parameters Out-GridView does not release control until the windows is closed. So, in this situation the function will minimize the VS Code window allowing the grid window to be displayed. Then once the grid window is closed, VS Code will restore itself.

Note: This is designed for use with PowerShell 5 and below. It does not provide a replacement for the lack of Out-GridView in PowerShell Core 6.0. That fix is coming in PowerShell 7.0.