最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Powershell目錄文件夾管理權(quán)限的繼承和指定方法

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

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

# 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

相關(guān)文章

最新評論

娄底市| 洛南县| 湖口县| 南康市| 临汾市| 梧州市| 丹江口市| 信宜市| 青阳县| 乌恰县| 芮城县| 沈丘县| 辽阳县| 高唐县| 昭平县| 明光市| 格尔木市| 金寨县| 措勤县| 舒兰市| 龙口市| 蚌埠市| 克什克腾旗| 通榆县| 鄂托克前旗| 金寨县| 瑞安市| 洪湖市| 祥云县| 台中县| 毕节市| 禹州市| 普陀区| 周口市| 漯河市| 开鲁县| 洛浦县| 敦煌市| 永宁县| 景德镇市| 黄浦区|