开发者

Powershell Newbie: How do I filter results so that only the information I get back can be used in a pipeline?

开发者 https://www.devze.com 2023-01-24 15:19 出处:网络
Lets say I run a powershell command (in my case Group Policy related) but lets say I run this command:

Lets say I run a powershell command (in my case Group Policy related) but lets say I run this command:

PS C:>Get-GPO -All

and my output l开发者_如何学编程ooks like:

DisplayName : My Named GPO

DomainName : mydomain.com

Owner : Domain Admins

Id : Random_GUID ...

How can I "filter" that command so that it only returns the lines relating to DisplayName? Is that possible or will I need to do some string parsing that's not available inside a pipeline operation? Because ultimately, I'm looking to use that DisplayName param to pipe to another command.

Thanks in advance!


You can use Select-Object (or select in short)

Get-GPO -All | Select DisplayName
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号