亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

Powershell目錄文件夾管理權限的繼承和指定方法

 更新時間:2015年06月20日 09:31:41   投稿:junjie  
這篇文章主要介紹了Powershell目錄文件夾管理權限的繼承和指定方法,本文給出了創(chuàng)建文件夾、獲取當前權限、添加新的權限、添加管理員權限等,需要的朋友可以參考下

默認目錄的權限是繼承父目錄的,你當然可以關閉它的繼承和分配指定的權限。
下面例子創(chuàng)建了“PermissionNoInheritance”的文件夾,允許當前用戶讀取,同時管理員組獲得其所有管理權限,并關閉它的繼承。

# create folder
$Path = 'c:\PermissionNoInheritance'
$null = New-Item -Path $Path -ItemType Directory -ErrorAction SilentlyContinue
 
# get current permissions
$acl = Get-Acl -Path $path
 
# add a new permission for current user
$permission = $env:username, 'Read,Modify', 'ContainerInherit, ObjectInherit', 'None', 'Allow'
$rule = New-Object -TypeName System.Security.AccessControl.FileSystemAccessRule -ArgumentList $permission
$acl.SetAccessRule($rule)
 
# add a new permission for Administrators
$permission = 'Administrators', 'FullControl', 'ContainerInherit, ObjectInherit', 'None', 'Allow'
$rule = New-Object -TypeName System.Security.AccessControl.FileSystemAccessRule -ArgumentList $permission
$acl.SetAccessRule($rule)
 
# disable inheritance
$acl.SetAccessRuleProtection($true, $false)
 
# set new permissions
$acl | Set-Acl -Path $path

相關文章

最新評論