获取 ADComputer,一些 - 属性未显示在格式中 - Table

Get-ADComputer, some -Properties not showing up in Format-Table

我正在收集域中所有计算机的列表,并尝试以格式化的 table 格式显示一些特定属性。这是我正在使用的命令:

Get-ADComputer `
-Filter "objectclass -eq 'computer'" `
-SearchBase "DC=JHanDomain,DC=local" `
-Properties info | FT Name,Enabled,whenCreated,whenChanged,DistinguishedName -A

代码运行没有错误并显示格式良好的 table,但是 the data in the 'whenCreated' and 'whenChanged' columns are missing.

当我只做 -Properties whenChanged,whenCreated 时它显示正常,但当我尝试将其格式化为 table 时却没有显示。 Any idea why this might be?

无论您需要在默认属性之外显示哪些其他属性,都需要添加到 -Properties 列表中,因此在您的情况 whenCreated,whenChanged 中,我删除了信息,因为您没有显示它.如果您仍然选择所有属性,也可以使用 * 代替

Get-ADComputer `
-Filter "objectclass -eq 'computer'" `
-SearchBase "DC=JHanDomain,DC=local" `
-Properties whenCreated,whenChanged | FT Name,Enabled,whenCreated,whenChanged,DistinguishedName -A

来自 Get-ADComputer 帮助:

   -Properties string[]
       The properties of the output object to retrieve from the server.
       Use this parameter to retrieve properties that are not included in the default set.
        
       Specify properties for this parameter as a comma-separated list of names.
       To display all of the attributes that are set on the object, use *

       To specify an individual extended property, use the name of the property.
       For properties that are not default or extended properties, specify the LDAP provider name.