朋友,帮助编写脚本以将ACL从.wim传输到当前系统。 必填:
powershell模块NTFSSecurity或icacls.exe
$iPath = Read-Host "Enter original location for reading ACL (D: \ wim \)" # mounted image .wim
$ACLPath = Read-Host "Enter the full name of the file in which to save the ACL (D: \ ACL_file)"
function Recurse($path) {
$fc = new-object -com scripting.filesystemobject
$folder = $fc.getfolder($path)
foreach ($i in $folder.files) {$i}
foreach ($i in $folder.subfolders) {
Write-Host $i.path
$i
if ((get-item -Force $i.path).Attributes.ToString ().Contains("ReparsePoint") -eq $false)
{
Recurse($i.path)
}
}
}
Recurse($iPath) | Get-NTFSAccess -ExcludeInherited | Export-Clixml $ACLPath".xml"
在我看来,帮助似乎没有完成(Add-NTFSAccess-?和Clear-NTFSAccess-?),无法理解如何将.xml中的规则应用于路径C:\