January 2008
Intermediate to advanced
688 pages
19h 12m
English
The ability to make decisions to control branching in a script is a fundamental technique. In fact, this is the basis of automation. A condition is detected and evaluated, and a course of action is determined. If you are able to encapsulate your logic into a script, you are well on your way to having servers that monitor themselves. As an example, when you open Task Manager on the server, what is the first thing you do? I often sort the list of processes by memory consumption. The GetTopMemory.ps1 script, shown here, does this.
Example 2-8. GetTopMemory.ps1
Get-Process | Sort-Object workingset -Descending | Select-Object -First 5
The GetTopMemory.ps1 script might be useful because it saves time in sorting a list. ...
Read now
Unlock full access