How to select and de-select checkboxes in a Table, using a button?

I ended up implementing a workaround, similar to what you described, here: https://forums.ironmansoftware.com/t/get-and-set-udelement-on-a-textbox-that-is-in-a-hidden-table-column/6363/2

Doing this workaround involved disabling the textbox in a row that successfully processes, and leaving the textbox enabled on failure. On refreshing the UDDynamic the table’s wrapped in, I loop through the selected rows and remove those with a textbox still enabled. This removes those that failed processing, and leaves me with a list of VM Names that are no longer needed in the table. I then list all the rows in the table, grab their VM Name, and filter out the ones we no longer need. Then I lookup the remaining VMs in VMware, create new objects, and then re-create the table with only the remaining VMs to work with.

Some of this convoluted process could be eliminated if we can find a way to select/de-select the checkboxes in a table using -ShowSelection. I tried for 2 days before posting this question…LOL

The entire convoluted process could be eliminated if we could do 2 things:

  1. Select/De-Select the checkboxes in a table using -ShowSelection
    a. When processing actions for selected rows, we can take an action to de-select a row on failure; using Try/Catch.

  2. Have a simple way to remove selected rows from the table:
    a. If we perhaps had a command to remove the selected rows, we wouldn’t need to wrap a lot of stuff into a UDDynamic and do table refreshes by calling Sync-UDElement on the UDDynamic ID.
    b. Maybe something like Sync-UDTable -Id ‘table-id’ -RemoveSelectedRows
    c. Just tossing that out there :wink:

Thanks,
Rob