Learn about Windows PowerShell
Summary: Beginner Event 1 of the 2012 Scripting Games uses Windows PowerShell to identify a working set of processes.
About this event
Date of Event
4/2/2012 12:01 AM
4/9/2012 12:01 AM
You are the network administrator for a small, single-location company. Your desktops are all running Windows 7, and your servers are all running Windows Server 2008 R2. Your company has a single domain, and Windows PowerShell remoting is enabled on all computers—both servers and desktops. Your boss is concerned because a number of users have complained that their computers are slow. This is surprising and alarming because each user received a new desktop when they were migrated to Windows 7. To better get a handle on what is going on with the desktop computers, your boss has directed you to ascertain the top ten processes that are consuming memory resources on each computer.
You decide, after doing a bit of research, that the working set of each process would be the best property to track. You also decide to use Windows PowerShell to gather the information. An acceptable output is shown in the following image.
2012 Scripting Games: All Links on One Page
I invite you to follow me on Twitter and Facebook. If you have any questions, send email to me at email@example.com, or post your questions on the Official Scripting Guys Forum. Good luck as you compete in this year’s Scripting Games. We wish you well.
Ed Wilson, Microsoft Scripting Guy
@Dawn Villejoin by the way, I hate your second one-liner with all the aliases, it is hard to read ... But I would not have counted off if you had used it ... I might have commented ... but I would not have counted off in this event.
@IamMred As do I... I only put it there because so many judges are commenting to use more aliases... And it took me longer to look up some of the aliases than it would have taken to just type it out (even less time to use Tab Completion in Powershell)! :)
@Dawn Villejoin Some aliases I nearly always use at the PowerShell prompt: cls, dir, md, sl, h, r, %. Aliases, once learned, can make the powershell console faster to use. Some aliases I hate, and refuse to use: Foreach for example. In a script, I NEVER use any aliases because I consider them a bad practice --- lots of reasons here.
@IamMred "Never use aliases in a script" I get... But in your opinion, what is the best practice for positional parameters? OK to leave out or should those be included?
@Dawn Villejoin at the PowerShell console, I often use positional parameters (there are also positional aliases such as CN for computername) because it makes the commands easier to read and to understand. In a script I ALWAYS use the complete parameter name because I want it to be perfectly clear.
I figured that had something to do with it. I figured I misinterpreted 'Capable' as the command itself IS capable of running against a remote computer, either by adding the -ComputerName parameter or Invoke-Command. I assumed the deduction was related to the judge's comment. Truth be told, this has been one of my biggest frustrations with the scripting games. If I get 5 stars I know that I've met all the requirements, but if a judge is going to deduct stars it would be incredibly helpful to know why. It does me know good to tell me that I've done something incorrectly and not tell me what.