以get-adgroup PowerShell指令輸出csv檔時,部分欄位值出現異常
問題:
當您以get-adgroup搭配Export-Csv 指令輸出為csv檔時,部分欄位值被變更為 "Microsoft.ActiveDirectory.Management.ADPropertyValueCollection"
原指令:
get-adgroup -filter * -Properties * | select-object name,mail,description,ManagedBy,dlMemSubmitPerms | Export-Csv c:\adgroup.csv
輸出結果:
修改後的指令:
get-adgroup -filter * -Properties * | select-object name,mail,description,ManagedBy,@{n="dlMemSubmitPerms";e={[string]$_.dlMemSubmitPerms}} | Export-Csv c:\adgroup.csv
參考資料:
Can't query some attributes
Windows PowerShell Tip of the Week