2017-06-20 34 views
1

我一直在試圖導出列出屬性'businesscategory'的列表。Get-ADuser屬性'businesscategory'

下面是一個命令:

ipmo activedirectory 

get-aduser -Filter * -Properties * | select userprincipalname, businesscategory |export-csv -Path C:\Temp\businesscategory.csv -Delimiter ";" -NoTypeInformation 

的事情是,我在我的.csv獲得該行 'businesscategory' 這下輸出:

「Microsoft.ActiveDirectory.Management.ADPropertyValueCollection」

儘管在Powershell控制檯中輸出很好。

我一直在尋求在互聯網的答案,但沒有成功迄今...

謝謝你們。

回答

1

這是一個多值屬性,所以你必須創建一個新的屬性並連接所有的值或選擇它們

get-aduser -filter * -Properties * | select userprincipalname, @{n="businesscategory";e={$_.businesscategory -join " "}} 

然後將它導出爲CSV格式的字符串之一。

+1

只是爲了便於閱讀,一旦它在電子表格中,我會用逗號或逗號分隔連接或逗號空格,如'-join',''。 – TheMadTechnician

+0

好的,謝謝你們。但是正如你所看到的,我已經通過管理這些值來保持UPN和業務類別的信息。還有別的... – Charlypop

+0

@Charlypop我不確定你的意思。 –