您好,我正在尝试导出文件共享权限,但通常我们的许多共享的文件路径长度超过260个字符。
从我可以告诉NTFSSecurity模块(https://www.powershellgallery.com/packages/NTFSSecurity/4.2.4)应该工作超过260个字符长度,但我不认为它是正确的工作,因为dir不支持超过260个字符长度。
任何帮助,可以得到下面的工作与模块的赞赏。
Get-Module -ListAvailable
Import-module -name NTFSSecurity
set-location -path D:Shares
Dir -dir -recurse | Get-ntfsaccess |export-csv c:temptest.csv
如果你想花哨一点,下面是一个更好的版本,提示输入path而不是修改脚本,最后的策略设置现在等待Y/N输入来设置它,而不是在脚本的另一部分完成后设置它。
$path = Read-Host "请输入path">
$policy = get-executionpolicy
Set-executionpolicy绕过
Get-Module -ListAvailable
Import-module name NTFSSecurity
Get-ChildItem2 -Path $Path -Recurse -Directory| Get-ntfsaccess |export-csv c:tempfileshareoutput.csv
$msg = '文件已停止增长? '[Y/N] '
做{
$response = Read-Host -Prompt $msg
if ($response -eq 'y') {
Set-executionpolicy美元政策
write-host 'policy set为'
write-host美元政策
}
} until ($response -eq 'n')