Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Tuesday, December 3, 2013 10:42 PM
I have been using PowerShell to automate some functions. One of them is when I call an exe file to process user accounts. The exe file produces a popup. It looks like a form with no options but to use the x in the corner to close.
Is there a command in PowerShell that will close all opened popups?
All replies (6)
Friday, December 6, 2013 7:27 AM âś…Answered
Hi,
To get the process that holds those popups, we could first close them all, and then run:
$processes_before = get-process
Then open those popups, run:
$processes_after = get-process
then:
compare-object -referenceobject $processes_before -differenceobject $processes_after
Regards, Yan Li
Tuesday, December 3, 2013 11:22 PM
Hi,
You can use Stop-Process:
http://ss64.com/ps/stop-process.html
Don't retire TechNet! - (Maybe there's still a chance for hope, over 12,420+ strong and growing)
Thursday, December 5, 2013 9:56 AM
Hi,
Any update? Have you tried above suggestion?
By stop-process processname we should be able to achieve what you want.
If you are TechNet Subscription user and have any feedback on our support quality, please send your feedback here.
Regards, Yan Li
Thursday, December 5, 2013 10:42 AM
I was actually trying this. However, I was having a hard time figuring out what process the popup is. Its not obvious. It looks like a powershell form. So I don't want to close powershell as I have a few more functions to go through. I was just hoping there was a function that would close all popups created in Powershell. But I will continue to try,
Friday, December 6, 2013 10:46 AM
Ok. Figured it out. It was a matter of getting the correct syntax and name. Dtop process -name "process name".
I found out that the name displayed in the task manager is not always the correct name for the stop-process
To find the correct name, I used the get-process and then used the name column for the process I wanted to close.
Then used
Stop-process -name "Processname"
And now that I am coming back to this post I see that you have a way to compare the processes. That is an awesome idea! Thank you I will try that next.
Yan Li, you did a wonderful job answering my question. Thank you :)
Friday, December 6, 2013 6:21 PM
Yan Li, you did a wonderful job answering my question. Thank you :)
Why not mark his reply as the answer?
Al Dunbar -- remember to 'mark or propose as answer' or 'vote as helpful' as appropriate.