English 中文(简体)
PowerShell Exchange 2003: 查询 ActiveDirectory 中的 ActiveSync、Office 和描述?
原标题:
  • 时间:2009-02-16 05:37:23
  •  标签:

我正在使用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 
问题回答

这里有一种方式:

$search = System.DirectoryServices.DirectorySearcher $search = 系统.DirectoryServices.DirectorySearcher

$search.filter = "(&(homeMDB = *)(objectcategory = 用户)(objectclass = 用户))"

$属性 = “mailNickName”,“displayName”,“physicaldeliveryofficename”,“description”,“msExchOmaAdminWirelessEnable”

$props | foreach I am sorry for the misunderstanding.[void]$search.PropertiesToLoad.Add($_) } 将其翻译为中文:$props | foreach I am sorry for the misunderstanding.[void] $search.PropertiesToLoad.Add($_) }

$users = $search.findAll() translates to:$users = $search.findAll()

foreach($u in $users) 的中文翻译为:对于$users中的每个$u

I am sorry for the misunderstanding.

$DisplayName = @{name="显示名称";expression={$u.properties.item("显示名称")}}

$Office = @{name="办公室";expression={$u.properties.item("physicaldeliveryofficename")}}

$Description = @{name="描述";expression={$u.properties.item("描述")}}

$Activesync = @{name="Activesync";expression={$u.properties.item("msExchOmaAdminWirelessEnable")}Sorry, it seems that the text you want to translate is missing. Could you please provide the text you would like to have translated? $Activesync = @{name="Activesync";expression={$u.properties.item("msExchOmaAdminWirelessEnable")}}。

$u | 选择$DisplayName,$Office,$Description,$Activesync

Sorry, it seems that the text you want to translate is missing. Could you please provide the text you would like to have translated?





相关问题
热门标签