#将组策略首选项中的"本地用户和组"下的所有条目导出
$xml = Get-GPOReport -ReportType Xml -Name "China Desktop Policy"
$report = New-Item -ItemType file -Path C:\Toolkits\GPOAdminRight.CSV -Force
Add-Content -Path $report -Value "Name,EmpNo,Computer,Description"
$e = ($xml.gpo.computer.ExtensionData | where name -EQ 'local users and groups').Extension.LocalUsersAndGroups
$e.Group | foreach {
$_.name + "," + $_.properties.members.member.name + "," + $_.filters.filtercomputer.name + "," + $_.desc
} | Out-File -FilePath $report -Append -Encoding ascii