Powershell 将Listview项目导出到CSV文件
我有一个包含5列的列表视图,需要将其导出为CSV 这就是它看起来的样子。我环顾四周,找不到解决问题的可行办法 以下是我将数据添加到listview的方式:Powershell 将Listview项目导出到CSV文件,powershell,csv,listview,Powershell,Csv,Listview,我有一个包含5列的列表视图,需要将其导出为CSV 这就是它看起来的样子。我环顾四周,找不到解决问题的可行办法 以下是我将数据添加到listview的方式: $searcher = [adsisearcher]"(samaccountname=$Content)" foreach ($DirectReportDN in $searcher.FindAll().Properties.directreports) { $DirectReport = [adsi]"LDAP://$DirectR
$searcher = [adsisearcher]"(samaccountname=$Content)"
foreach ($DirectReportDN in $searcher.FindAll().Properties.directreports)
{
$DirectReport = [adsi]"LDAP://$DirectReportDN"
$Username = $DirectReport.Properties.samaccountname
$Associate = $DirectReport.Properties.name
$Title = $DirectReport.Properties.title
$Mgr = $DirectReport.Properties.extensionattribute6
$Dept = $DirectReport.Properties.department
Add-ListViewItem -ListView $listview2 -Items $Username -Group $listview2.Groups[0] -SubItems "$Associate", "$Title", "$Mgr", "$Dept"
}
任何帮助都将不胜感激,我已经为此工作了一段时间。谢谢 将项目导出为CSV:
$ListViewName.Items | Export-CSV -Path "some\path.csv" -NoTypeInformation
不幸的是,这只是把一堆关于列表视图的信息放在那里。例如背景色、边界、图像键等。我需要其中的列和行。扎克-你的答案是狗屎。。对不起,伙计。我会带着正确的答案回来