首页 > 解决方案 > 从电话号码中获取其他字段

问题描述

我想从 AD 用户属性中的其他字段电话号码中获取值。但是,我正在获取Microsoft.ActiveDirectory.Management.ADPropertyValueCollection CSV 文件。

Get-ADUser -Filter {(emailaddress -like "*@domaina.com" -and Enabled -eq $true -and sAMAccountName -like "MSS*") -or (emailaddress -like "*@domainb.com" -and Enabled -eq $true -and sAMAccountName -like "MRP*")} -SearchBase "OU=Company,DC=contoso,DC=local" -SearchScope Subtree -Properties * ,otherTelephone | Select-Object givenName, sn, displayname,TelephoneNumber,HomePhone,othertelephone,mobile, ipphone, Fax , physicaldeliveryofficename,title,mail |Export-CSV -Path "C:\list.csv" -NoTypeInformation -Encoding UTF8

谢谢,

标签: powershell

解决方案


我想这是 ADPropertyValueCollection,您可以尝试使用选择的自定义属性打开它,例如

| Select-Object ..., @{ Name=”OtherTelephone”; Expression={$_.otherTelephone.exactPropertyYouLookingFor}, ...

推荐阅读