【发布时间】:2014-03-12 13:42:52
【问题描述】:
我有下面的代码,我想导出到 csv 文件。不确定将 export-csv 行放在哪里?
Get-ChildItem \\server\share| Where {
$_.PSIsContainer
} | Get-ACL | ForEach {
$Identity = $_.Access | Where {$_.IdentityReference -like '*-W'}
$Group = ($Identity.IdentityReference -split '\\')[1]
If ($Identity) {
"Found $($Identity.IdentityReference)"
#Assumes you do not have ActiveDirectory module
$Members = ([adsisearcher]"name=$($Group)").FindOne().GetDirectoryEntry().member -replace 'CN=(.*?)\,.*','$1'
New-Object PSObject -Property @{
FullName = Convert-Path $_.Path
Identity = $Identity.IdentityReference
Members = $Members
}
}
}
这是当前的输出
【问题讨论】:
标签: powershell csv