I am writing a script which deletes users who have not logged in since a user-provided date.
I want to do the following:
- Get date from user. (no problem here)
- Get a list of users. (no problem here)
- Present the user with a ListView of the potentially affected users. (no problem here)
- Wait for the modal window to be closed before proceeding (this is where I get stuck)
- Do some other stuff...
Steps 1-3 work fine, but when the modal window pops up, all of the code after gets executed immediately with the model window still open.
I thought Wait-ScriptSession might be my answer, but it is not doing the trick. Here's what I have right now (psuedo-code)
#gather users, etc
Start-ScriptSession -ScriptBlock {$listOfRemovedUsers | Show-ListView @outputProps -Property $columns} -Id "Removable Users Modal" -Interactive
Wait-ScriptSession -Id "Removable Users Modal" -Timeout 30
#do some more stuff