Figure 13-4. Output of Get-WmiObject command
440 Microsoft Windows Server 2008 Administration
When we talk about Windows PowerShell separating data from presentation, we??™re
saying that data returned by a cmdlet isn??™t actually how it ends up being displayed on
the screen. So do I have you scratching your head now? This concept is not really that
difficult. In traditional command-line tools, data would typically be retrieved by the
command, and it would be formatted to look pretty much as it does on the screen. Sometimes
a command would have switches that would allow the display to be different. For
example, the typical command-line DIR command displays the directory listing as a
fairly detailed list by default, but you can use the /W switch to display it in wide format,
where only file names are displayed in columns. While that works fine when you??™re
dealing with one command, it becomes troublesome when you want to use that output
in a different command. Typically, you would have to run some command-line tool or
build a script that could parse the output of the previous command and translate it into
useful data for the next command.
Working with output as strings brings about many limitations, such as dealing with
special characters or trying to parse command output of something that doesn??™t generate
output where a pattern for parsing out useful information can be clearly defined.
Pages:
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466