Output of the PowerShell help command
438 Microsoft Windows Server 2008 Administration
With those basics out of the way, let??™s delve into some really cool stuff before taking
a step back to talk about more technical details. Whenever you are working on a server
and troubleshooting an issue, you often go to the Task Manager to see what processes
are running, who??™s using them, how much memory they are using, and other information.
With previous versions of Windows, if you wanted to get more information from
the command prompt, you would have to rely on some resource kit or third-party tools.
PowerShell, on the other hand, comes with a cmdlet that you can use to show all your
running processes:
Get-Process
This command sorts the output by the Process Name by default; however, for example,
say you wanted it sorted by process ID. No problem; just run this:
Get-Process | Sort-Object Id
Another common administrative task is managing Windows Services. This is a snap
with PowerShell, since it has built-in cmdlets for managing services. To see a list of all
the services on the system and its status, you can run this command:
Get-Service
You can also indicate a specific service you want to query by providing the service
or display name, and you can use wildcards if you don??™t know the exact name. For example,
the following command will list the status of all services that contain the string
win in the display name:
Get-Service -displayname *win*
Windows PowerShell also includes cmdlets that allow you to interact with Windows
Management Interface (WMI) with relative ease.
Pages:
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464