首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >PowerShell以启用set COM+安全框

PowerShell以启用set COM+安全框
EN

Stack Overflow用户
提问于 2016-11-14 20:35:37
回答 1查看 262关注 0票数 0

我正在编写一个脚本,以启用复选框、强制组件级访问检查,并在角色之前选中该复选框。

这是我到目前为止拥有的代码(更改为COM+应用程序的名称):

代码语言:javascript
复制
$comAdmin = New-Object -ComObject COMAdmin.COMAdminCatalog
$apps = $comAdmin.GetCollection('Applications')
$apps.Populate()
$targetApp = '<appname>'
$app = $apps | Where-Object -FilterScript {
    $_.Name -eq $targetApp
}
$components = $apps.GetCollection('Components',$app.key)
$components.Populate()

foreach ($component in $components)
{
    $componentName = $component.Name
    $componentID = $component.Value('CLSID')
}



$accesschecks = $component.Value('ComponentAccessChecksEnabled')
$component.Value('ComponentAccessChecksEnabled') = $true
$components.SaveChanges()




$comAdmin = New-Object -ComObject COMAdmin.COMAdminCatalog
$apps = $comAdmin.GetCollection('Applications')
$apps.Populate()

$app = $apps|Where-Object -FilterScript {
    $_.Name -eq $targetApp
}
$components = $apps.GetCollection('Components', $app.Key)
$components.Populate()
$components.GetCollection('RolesForComponent', $component.Key)

foreach ($component in $components)
{
    $component.Value('ComponentAccessChecksEnabled') = $true
    $component.value('RolesForComponentEnabled') = #t
    '{0,-30}{2,-10}{1}{1}' -f $component.Name, $component.Value('CLSID'), $component.Value('ComponentAccessChecksEnabled'), $component.Key

}
$components.SaveChanges()

脚本的第一部分工作,它启用复选框。但是第二部分没有选中角色之前的复选框。现在看起来是这样:

我需要一点帮助,以使脚本工作,以复选框。有什么想法吗?

EN

回答 1

Stack Overflow用户

发布于 2016-11-15 11:27:41

检查是否可以通过注册表启用复选框。如果您已经拥有COM对象的ClassId,则可以在它之后搜索注册表。如果它存储在注册表中,则可以通过Set-ItemProperty更改密钥。

希望这能有所帮助。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/40597386

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档