Mat*_*ner 5 powershell windows-server-2008
尽管所有在线文档和示例都说明 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...
Run Code Online (Sandbox Code Playgroud)
sat-selpa 是我运行它的 Server 2008 R2 服务器,本地主机。
为什么只有9个属性?我在网上搜索过,但似乎找不到其他有这种经历的人。
您Get-AdComputer
仅使用对象的默认属性。使用-Properties *
来抓取它们:
Get-ADComputer -filter {name -eq "sit-selpa"} -Property * | Get-Member
Run Code Online (Sandbox Code Playgroud)
然后,只是得到OperatingSystem
:
Get-ADComputer -filter {name -eq "sit-selpa"} -Property * | Select-Object OperatingSystem
Run Code Online (Sandbox Code Playgroud)
但是,您不需要使用通配符获取所有对象属性。您可以明确指定附加属性:
Get-ADComputer -Identity sit-selpa -Properties OperatingSystem
...
Get-ADComputer -Identity sit-selpa -Properties OperatingSystem, OperatingSystemVersion
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
3396 次 |
最近记录: |