查找计算机名称-筛选名称和操作系统

我正在尝试过滤名称和操作系统。

我可以命名或使用操作系统。但是我不能两者都做。

我该如何工作

Get-Content "C:\test.txt" | foreach {((Get-ADComputer $_ -Server:"Server 123"-Properties name,operatingsystem).name)}

Get-Content "C:\test.txt" | foreach {((Get-ADComputer $_ -Server:"Server 123"-Properties name,operatingsystem).operating system)}

以上两项。

Get-Content "C:\test.txt" | foreach {((Get-ADComputer $_ -Server:"Server 123"-Properties name,operatingsystem).name.operating system)}

错误

nanhuathyy98 回答:查找计算机名称-筛选名称和操作系统

使用Select-Object选择所需的属性。

Get-ADComputer -Identity $ComputerName -Properties Name,OperatingSystem | Select-Object -Property Name,OperatingSystem
本文链接:https://www.f2er.com/3138112.html

大家都在问