使用Powershell授予DCOM上的本地组(IIS_IUSRS)访问权限

时间:2019-12-05 04:04:06

标签: powershell dcom

我正在寻找一种授予本地组(IIS_IUSRS)权限的方法,我发现此Powershell脚本HERE对于域用户而言效果很好,但是我试图将访问权限授予一个本地组,不确定是否需要更改脚本以使其正常工作。

不是: 我正在寻找Powershell脚本或命令,我不能使用任何第三方软件。

这是脚本


$user = "sql2012agent"
$domain = "MYDOMAIN"
$appdesc = "Microsoft SQL Server Integration Services 11.0"
$app = get-wmiobject -query ('SELECT * FROM Win32_DCOMApplicationSetting WHERE Description = "' + $appdesc + '"') -enableallprivileges
#$appid = "{83B33982-693D-4824-B42E-7196AE61BB05}"
#$app = get-wmiobject -query ('SELECT * FROM Win32_DCOMApplicationSetting WHERE AppId = "' + $appid + '"') -enableallprivileges
$sdRes = $app.GetLaunchSecurityDescriptor()
$sd = $sdRes.Descriptor
$trustee = ([wmiclass] 'Win32_Trustee').CreateInstance()
$trustee.Domain = $domain
$trustee.Name = $user
$fullControl = 31
$localLaunchActivate = 11
$ace = ([wmiclass] 'Win32_ACE').CreateInstance()
$ace.AccessMask = $localLaunchActivate
$ace.AceFlags = 0
$ace.AceType = 0
$ace.Trustee = $trustee
[System.Management.ManagementBaseObject[]] $newDACL = $sd.DACL + @($ace)
$sd.DACL = $newDACL
$app.SetLaunchSecurityDescriptor($sd)

任何帮助将不胜感激。

谢谢

0 个答案:

没有答案