Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
VBScript/PowerShell,如何编写脚本以保护Windows注册表_Windows_Powershell_Vbscript_Registry - Fatal编程技术网

VBScript/PowerShell,如何编写脚本以保护Windows注册表

VBScript/PowerShell,如何编写脚本以保护Windows注册表,windows,powershell,vbscript,registry,Windows,Powershell,Vbscript,Registry,我想使用WScript.Shell对象来保护注册表路径,例如HKEY_LOCAL_MACHINE\SOFTWARE\Business Objects\Registration\UserProfile 因此,目标是为“everyone”创建一个新权限,并拒绝以下内容:删除、创建子键等 谷歌搜索了很多,没有就我的具体问题达成协议,有人能给我一个提示吗?谢谢 也许这会有帮助 $acl = Get-Acl "HKLM:\SOFTWARE\Business Objects\Registration\Use

我想使用WScript.Shell对象来保护注册表路径,例如HKEY_LOCAL_MACHINE\SOFTWARE\Business Objects\Registration\UserProfile

因此,目标是为“everyone”创建一个新权限,并拒绝以下内容:删除、创建子键等

谷歌搜索了很多,没有就我的具体问题达成协议,有人能给我一个提示吗?谢谢

也许这会有帮助

$acl = Get-Acl "HKLM:\SOFTWARE\Business Objects\Registration\UserProfile"
$rule = New-Object System.Security.AccessControl.RegistryAccessRule ("mycomp\everyone","FullControl","Allow") # or deny...
$acl.SetAccessRule($rule)
$acl |Set-Acl -Path "HKLM:\SOFTWARE\Business Objects\Registration\UserProfile"
要添加或删除访问规则,需要将该规则创建为RegistryAccessRule类型的对象,然后使用SetAccessRule()或RemoveAccessRule()方法从ACL中创建或删除该规则


举另一个例子:

Get Acl仅对文件有效,我猜,当我尝试现有注册表路径时,它会说:找不到路径XXX,因为它不存在Get Acl在注册表和其他PSDrive中有效。尝试获取pssdrive,您可以在列表中看到HKLM和HKCU。可能您的注册表路径不存在或错误?如果路径上有空格,则必须在“”中写入。