小编Bal*_* RR的帖子

检查文件夹是否被授予访问权限

我是 PS 脚本新手。刚刚开始编写一个脚本来查找用户是否正确授予文件夹权限。文件夹名称和AD帐户名称相同。假设如果文件夹名称是 XX11223,那么用户 XX11223 应该有权访问该特定文件夹。未正确许可的文件夹应打印到文件中。请有人帮忙解决这个问题。

$Paths = Get-Content "Path.txt"

#To get the subfolders for which the permissions has to be checked

$Folder = foreach ($Path in $Paths) {
    $Path = $Path | Select-Object -Unique
    Write-Host $Path -ForegroundColor Green
    Get-ChildItem $Path | Where-Object { $_.Attributes -eq 'Directory' } | Select-Object FullName
}

#To get the ACLs for the list of folders from above

$ACLS = Get-Content $Folder

$Out = foreach ($ACL in $ACLS) { 
    Write-Host $ACL -ForegroundColor Cyan
    Get-Acl $ACL …
Run Code Online (Sandbox Code Playgroud)

directory powershell subdirectory

4
推荐指数
1
解决办法
4450
查看次数

标签 统计

directory ×1

powershell ×1

subdirectory ×1