本帖最后由 newswan 于 2021-6-18 19:14 编辑
回复 3# 18831281895
powershell- get-acl * | select-object path,owner
复制代码 完整的- $path ="a"
-
- $Account = New-Object System.Security.Principal.NTAccount("Everyone")
- $acl = new-object System.Security.AccessControl.FileSecurity
- $acl.SetOwner($Account)
-
- Get-ChildItem -path $path | foreach-object {
- if ( -not ((get-acl $_).owner -like "*admin"))
- {
- $acl | set-acl $_
- }
- }
复制代码
|