简体   繁体   English

检索Active Directory计算机说明时遇到问题

[英]Trouble retrieving Active Directory computer description

When I run: 当我跑步时:

$computer = Get-ADComputer -SearchBase 'OU="Windows 7 Machines",OU="Devices",dc=blah,dc=Local' -Filter 'name -like "computerName"' -Properties Description

I'm able to get the AD description using 我可以使用获取广告描述

$computer.Description

My question is: how do I get the computer description without using the -Properties Description argument? 我的问题是:如何在不使用-Properties Description参数的情况下获取计算机描述?

$computer = Get-ADComputer -SearchBase 'OU="Windows 7 Machines",OU="Devices",dc=blah,dc=Local' -Filter 'name -like "computerName"'

How do I get the description from the $computer variable here? 我如何从这里的$computer变量获取描述?

With Get-ADComputer or some other LDAP query tools? 使用Get-ADComputer或其他LDAP查询工具? You don't. 你不知道

Specifying -Properties Description is what tells the Get-ADComputer cmdlet to request the description field from the LDAP server. 指定-Properties Description是告诉Get-ADComputer cmdlet向LDAP服务器请求description字段的原因。 If you don't specifically request it, the LDAP server does not send it in the response back to the cmdlet. 如果您没有特别要求,则LDAP服务器不会在响应中将其发送回cmdlet。 You must specify any fields you want beyond the defaults, and description is not a default field. 您必须指定除默认值之外的任何所需字段,并且description不是默认字段。

I mean sure, ok, you could say -Properties * , and that technically answers your question, but then you're asking for every property (this is bad; it takes much longer). 我的意思是肯定的,好的,您可以说-Properties * ,并且从技术上讲可以回答您的问题,但是随后您需要的是每个属性 (这很糟糕;需要更长的时间)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM