Powershell – Prompt user then expire prompt after xx seconds

Question:

I am trying to display a promp for user action and if no action is taken have the prompt close and teh script continue on. here is my command prompt dialog configuraiton



I have looked up and down the internet I have seen this implemented in C# but for the life of me i cannot determine the best approach for powershell. I would appreciate any help.

Thank you

Edit: Thank you Noah, here is the updated code, it is even more compact too!

Answer:

Here you go…dug this out of one of my old scripts

Source:

Powershell – Prompt user then expire prompt after xx seconds by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply