Learn about Windows PowerShell
Summary: Here is Problem 4 in Windows PowerShell Mini-Scripting Games 2014.
Microsoft Scripting Guy, Ed Wilson, is here. Today we have problem four in the Windows PowerShell Mini-Scripting Games. Remember: Please do not post any answers to these problems until next week. Please do not spoil the fun for your fellow scripters!
Your manager tasked you with what he considers to be a really important issue. The people at the Help Desk want a tool that will permit them to easily stop processes. Your manager doesn’t want to give them permission to use Task Manager because it carries too much power.
He decided that he wants you to write a script that will permit people who run the script to kill any process that they have user rights to stop. Your manager does not want people to be able to stop any process, only those for which they have user rights.
Create a graphical interface that lists processes. Permit users to select a process from the list and stop that process.
Hint: Do not do any more work on this project than you need to accomplish the task.
Mini-Scripting Games Week will continue tomorrow when I will unveil the last question (PowerTip) and problem.
I invite you to follow me on Twitter and Facebook. If you have any questions, send email to me at firstname.lastname@example.org, or post your questions on the Official Scripting Guys Forum. See you tomorrow. Until then, peace.
Ed Wilson, Microsoft Scripting Guy
Powershell.exe should be right behind task manager on the list.
"Your manager doesn’t want to give them permission to use Task Manager because it carries too much power."
Problems don't get much more real-world than that. Clueless managers setting requirements!
(Dear Clueless Manager, The Win32 API controls which processes you're allowed to stop, based on your security context and whether or not you have the Debug Programs user right (which, by the way, should not be granted to anyone except on a temporary, as-needed
basis.) It doesn't matter whether you're using Task Manager, PowerShell, or uberMalware.exe. If you don't have permission to stop a process, Windows is going to give you a big, fat "Access Denied." Task Manager, a GUI front-end to some of these Windows API
functions, carries no power in and of itself.)
That said, this isn't "educate your manager" week, it's "Mini Scripting Games." So shut up, Dave, and solve the problem. :P