虽然所有在线文档和示例状态应该有一个OperatingSystem属性的Get-ADComputer的结果我没有一个在我的Win Server 2008 R2上。
这是Get-ADComputer上的所有内容:
PS I:\> Get-ADComputer -filter{name -eq "sit-selpa"} | Get-Member TypeName: Microsoft.ActiveDirectory.Management.ADComputer Name MemberType Definition ---- ---------- ---------- Contains Method bool Contains(string propertyName) Equals Method bool Equals(System.Object obj) GetEnumerator Method System.Collections.IDictionaryEnumer... GetHashCode Method int GetHashCode() GetType Method type GetType() ToString Method string ToString() Item ParameterizedProperty Microsoft.ActiveDirectory.Management... DistinguishedName Property System.String DistinguishedName {get... DNSHostName Property System.String DNSHostName {get;set;} Enabled Property System.Boolean Enabled {get;set;} Name Property System.String Name {get;} ObjectClass Property System.String ObjectClass {get;set;} ObjectGUID Property System.Nullable`1[[System.Guid, msco... SamAccountName Property System.String SamAccountName {get;set;} SID Property System.Security.Principal.SecurityId... UserPrincipalName Property System.String UserPrincipalName {get...
sit-selpa是Server 2008 R2服务器,我正在运行这个localhost。
为什么只有9个属性? 我在网上search,但我似乎无法find任何与此经验的人。
您的Get-AdComputer仅使用该对象的默认属性。 使用-Properties *来抓住他们:
Get-ADComputer -filter {name -eq "sit-selpa"} -Property * | Get-Member
然后,要获得OperatingSystem :
Get-ADComputer -filter {name -eq "sit-selpa"} -Property * | Select-Object OperatingSystem
但是,您不需要使用通配符来获取所有对象属性。 您可以明确指定其他属性:
Get-ADComputer -Identity sit-selpa -Properties OperatingSystem ... Get-ADComputer -Identity sit-selpa -Properties OperatingSystem, OperatingSystemVersion