Out-GridView for VS Code
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...
Input Box Pop-up
[System.Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic') | Out-Null $Value = [Microsoft.VisualBasic.Interaction]::InputBox("Enter a value", "Title", $null)
Yes/No Prompt
$yes = new-Object System.Management.Automation.Host.ChoiceDescription "&Yes","help" $no = new-Object System.Management.Automation.Host.ChoiceDescription "&No","help" $choices = [System.Management.Automation.Host.ChoiceDescription[]]($yes,$no) $answer = $host.ui.PromptForChoice("Prompt","Click yes to continue",$choices,0) if($answer -eq 0){ Write-Host "You clicked Yes" }elseif($answer -eq 1){ Write-Host "You clicked No" }