标签:
导出某个目录下所有文件夹权限,每个目录权限对应一个csv文件
$sfolder = "D:\FileShare\finance dep" $folders = gci $sfolder -Recurse | ? {$_.Mode -eq "d----"} $rfolder = "D:\Operations\Scripts\finance-p" foreach ($folder in $folders) { $f = $folder.fullname $acls = Get-Acl $f |select * $foldernamer = $acls.Path.Split("::")[3].replace("\","-") $foldername = $foldernamer.substring(1,$foldernamer.length-1) + ".csv" $folderpath = Join-Path $rfolder $foldername foreach($p in $acls.Accesstostring.split("`n")) { if($p.Contains("UXIN") -and (!$p.contains("Admin"))) { $ps = $p.Split(" ") $pcount = $p.Split(" ").length $ps[0] + "," + $ps[1..($pcount-1)] -join " " |Out-File $folderpath -Encoding UTF8 -Append } } }
标签:
原文地址:http://www.cnblogs.com/dreamer-fish/p/5543129.html