To filter results from a powershell query where-object can be used.
For example to filter get-spserviceapplication by field typename
/>Get-spserviceapplication |where-object{$_.typename –like “Search Service”
will result in all objects that contains Search Service. Switch –like for –eq to more precise results.
To get specific field to a variable
/>$serviceid = Get-spserviceapplication |where-object{$_.typename –like “Search Service” |select id
Simple but powerful.
References:
http://windowsitpro.com/powershell/where-object-filter-filters
No comments:
Post a Comment