無法在 Windows 上以管理員權限存取資料夾

無法在 Windows 上以管理員權限存取資料夾

我在 Windows 10 x64 上遇到資料夾權限問題。無論出於何種原因,我的資料夾權限始終需要「管理員權限才能存取某些資料夾」。當我授予管理員權限時,我收到一條權限被拒絕的訊息。即使擁有管理員權限,如何才能拒絕存取這些資料夾?

另外,如何透過 powershell 遞歸地向目前使用者授予資料夾的安全權限?

答案1

您可以嘗試以下powershell來重設使用者或管理員的權限。

根據Venkatakrishnan連結中的回答:使用 Powershell 設定 NTFS 權限

$Folderpath='Destination Folder'
$user_account='User Acccount'
$Acl = Get-Acl $Folderpath
$Ar = New-Object system.Security.AccessControl.FileSystemAccessRule($user_account, "FullControl", "ContainerInherit, ObjectInherit", "None", "Allow")
$Acl.Setaccessrule($Ar)
Set-Acl $Folderpath $Acl

希望它可以幫助你。

相關內容