Automation

 View Only
  • 1.  Powershell input filtering help

    Posted Jun 09, 2023 04:39 PM

    So, this is really not PowerCLI directly, but I thought someone might have already had a solution for this.

    I'm looking to have a single form with 3 input fields where input1 filters input2 and input2 filters input3. For example:

    User input1: type in vcenter URL (then do a read only login behind the scenes)

    Input2: shows list of clusters in vcenter of input1

    Input3: shows list of hosts in cluster chosen in input2

    I currently have it popping up a window for each input, but trying to simplify it for end users:

    Add-Type -AssemblyName Microsoft.VisualBasic
    $vc = [Microsoft.VisualBasic.Interaction]::InputBox("Enter the FQDN of the vcenter you want to standardize hosts.", "vCenter")
    connect-viserver -server $vc -Credential $cred
    $cluster = Get-Cluster | sort | Out-GridView -Title "Select the Cluster to standardize." -OutputMode Single
    $host = $cluster | Get-VMHost | sort | Out-GridView -Title "Select the Host to standardize." -OutputMode Single
     
    Is there any pwershell form building that allows this without diving deep into .NET form building?


  • 2.  RE: Powershell input filtering help
    Best Answer

    Posted Jun 09, 2023 06:46 PM

    You might want to have a look at Microsoft.PowerShell.ConsoleGuiTools.
    It runs cross-platform.

    A good introduction can be found in 
    The Ultimate Guide to Terminal User Interfaces in PowerShell

     



  • 3.  RE: Powershell input filtering help

    Posted Jun 09, 2023 07:45 PM

    $Dialog.Title = "Whoa"

     

    I think the Selection Events is exactly what I'm looking for.

     

    Thanks for the pointer!!