不知動到什麼東西導致 FSLogix 的 USer Profile 路徑下 NTFS Permission 亂掉
User Account 專屬的權限消失
因為 FSLogix 的目錄結構跟 Microsoft VDI 不一樣,所以不能直接用這篇文章的 Script 修
於是稍微修改一下成為以下 Script 來處理
===== 程式開始 =====
clear
write-host
write-host
$UPDPath = Read-Host -Prompt 'Input User Profile Disk Path'
$UPDFolders = Get-ChildItem -Path $UPDPath | Select Name,FullName
$colRights = [System.Security.AccessControl.FileSystemRights]"FullControl"
$objType =[System.Security.AccessControl.AccessControlType]::Allow
foreach ($UPDFolder in $UPDFolders) {
$UPDFolderName = $UPDFolder.Name;
$UPDFolderFullName = $UPDFolder.FullName;
$UPDFolderItem = $UPDFolderName -Split '_';
$SID = $UPDFolderItem[0];
$SID_Obj = New-Object System.Security.Principal.SecurityIdentifier($SID)
$InheritanceFlag = [System.Security.AccessControl.InheritanceFlags]::None
$PropagationFlag = [System.Security.AccessControl.PropagationFlags]::None
$HF_ace = New-Object System.Security.AccessControl.FileSystemAccessRule($SID_Obj, $colRights, $InheritanceFlag, $PropagationFlag, $objType)
$ACL = Get-ACL $UPDFolderFullName
$ACL.AddAccessRule($HF_ace)
Set-Acl -Path $UPDFolderFullName -AclObject $ACL
$UPD = Get-ChildItem -Path $UPDFolderFullName | Set-Acl -AclObject $ACL
};
===== 程式結束 =====
沒有留言:
張貼留言