2017-05-17 24 views
0

首先,我是使用PowerShell的新手,所以如果這看起來有點簡單,我很抱歉。 我正在嘗試在我的環境中獲取2003服務器的清單。
到目前爲止,這是我:從AD中提取某個操作系統的列表

Get-ADComputer -Filter *2003* -Property * | Format-Table Name,OperatingSystem,OperatingSystemServicePack 

我得到的語法錯誤。解析似乎掛在了Filter屬性上。我如何才能在我的環境中顯示2003服務器?

謝謝。

+0

這裏是[cmdlet上的MSDN頁面](https://technet.microsoft.com/en-us/library/ee617192.aspx)'-Filter'屬性的部分也應該是有幫助的。 – BenH

回答

1

抱歉,重複請求。這是我的最終代碼:

Get-ADComputer -Filter {(OperatingSystem -like "*windows*server*2003*") -and (Enabled -eq "True")} -Properties * | Sort Name | Format-Table Name,OperatingSystem,OperatingSystemServicePack,OperatingSystemVersion 

感謝您的幫助。