Thank you for recommending "Windows IT Pro is the leading independent community for IT professionals deploying Microsoft Windows server and client applications and technologies.".
Your recommendation has been successfully processed.
PowerShell with a Purpose Blog
by Don Jones
Demystify PowerShell, automate tedious systems administration tasks, and improve your IT efficiency with these concentrated nuggets of PowerShell goodness!
Why PowerShell is Like Algebra
So long as you read carefully, it can all make sense
Posted @ 1/25/2012 12:52 PM By Don Jones
Can you make sense of this?
Get-WmiObject -class Win32_BIOS -computername (Import-CSV file.csv | Select -expand Name)
The parentheses will trip up a lot of folks, but they really just do the same thing they did back in high school algebra: Force PowerShell to do the parenthesized part first. Treat the entire contents of the parens as a separate command. In fact, run it on its own to see what it does - this one assumes you have a CSV file that includes a Name column, which lists computer names. The result will be just the computer names, without a column header. Plain String objects, in other words, which is what the -computerName parameter desires.
Almost anytime you see parentheses in PowerShell, they're containing one or more commands; PowerShell executes the commands, and replaces the entire parenthetical bit with the results of the commands.
The only exceptions? When creating arrays and parameter blocks:
$array = @(1,2,3)
param([string]$name,[string]$path)
Those are two separate uses of parens that don't act as executable parenthetical expressions (exactly).
Related Content: