虽然所有在线文档和示例都说Get-ADComputer的结果应该有一个OperatingSystem属性,但我的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服务器.
为什么只有9个房产?我在网上搜索过,但我似乎无法找到有这种经历的人.
您的Get-AdComputer仅使用对象的默认属性.使用-Properties *将它们全部抓取:
原文链接:https://www.f2er.com/windows/367505.htmlGet-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