我正在使用PowerShell拉取Exchange 2003用户列表,并基于用户的邮箱“LegacyDN”,希望使用LDAP查询来拉取他们的activesyncenabled属性(msExchOmaAdminWirelessEnable)、描述和办公室;然而,似乎对我来说并不起作用。有什么想法吗?
这是我查询AD属性的方式:
$allusers = get-wmiobject -class exchange_mailbox -namespace rootmicrosoftexchangev2 -computername srv02 | select mailboxdisplayname, legacyDN
foreach ($user in $allusers)
{
$obj = new-object psobject
$exchangever = "2003"
$tmp = [adsi]("LDAP://" + $user.legacydn)
$obj | add-member -membertype noteproperty -name "Display Name" -value $user.mailboxdisplayname
$obj | add-member -membertype noteproperty -name "Office" -value $tmp.physicaldeliveryofficename
$obj | add-member -membertype noteproperty -name "Description" -value $tmp.description
$obj | add-member -membertype noteproperty -name "Activesync" -value $tmp.msExchOmaAdminWirelessEnable
$allusersemail += $obj
}
$alluseremail | export-csv \srv02logs est.csv