国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 開發(fā) > PowerShell > 正文

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

2020-03-26 19:08:53
字體:
供稿:網(wǎng)友

默認(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

 

 
發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 衡东县| 黔西| 津南区| 四川省| 齐河县| 江西省| 宝兴县| 金寨县| 高州市| 富宁县| 铜川市| 禄劝| 汽车| 枞阳县| 北辰区| 隆安县| 南乐县| 图们市| 邵东县| 墨竹工卡县| 武乡县| 巴彦淖尔市| 崇明县| 都江堰市| 蒙城县| 谷城县| 尚义县| 哈尔滨市| 隆安县| 郎溪县| 五峰| 张掖市| 丰宁| 甘洛县| 广昌县| 新晃| 顺义区| 南雄市| 天水市| 枞阳县| 永登县|