我是 powershell 的新手,并试图使用我发现的这个脚本来返回文件夹权限:
Function Get-SecGroups($path)
{
$a = @{};
get-acl -Path $path | %{Write-Host `n $path; $_.Access} | %{
#ONLY SHOW PERMISSIONS ON FOLDER, NOT FILES
#CHECK TO SEE IF THE USER/GROUP ONLY HAS "List" PERMISSION
if ($_.InheritanceFlags -eq "ContainerInherit")
{
Write-Host `t $_.IdentityReference "List";
}
else
{
Write-Host `t $_.IdentityReference, $_.FileSystemRights;
}
}
}
#END Get-SecGroups
get-childitem -Path "d:\*\*\" | where {$_.PsIsContainer} | %{Get-SecGroups($_.FullName)} | out-file c:\output.txt
我遇到的问题是它创建了 output.txt 但没有数据。数据显示在屏幕上。我哪里错了?