Falcas
Falcas

Reputation: 1

PowerShell: create a WMIClass (Win32_DCOMApplicationSetting) to modify Launch and Activation Permissions in DCOM

I am running a Docker Container with an Application. That tries to access an COM+ Application (to validate Licences), but can't because it lacks access-Rights. That's why I try to create a WMIClass (Win32_DCOMApplicationSetting) to modify Launch and Activation Permissions in DCOM.

You can do the needed changes in ComponentServices via Console Root\Component Services\Computer\My Computer\DCOM Config\Some Object -(right click)->Propertys\Security\Launch and Activation Permissions I want to automate so that is not a solution.

There are Solution that work on my localVm that utilise $wmi = (Get-WmiObject -Class Win32_DCOMApplicationSetting -Filter 'Caption="Some Object"' -EnableAllPrivileges) ,but thouse Solultion don't work in my Container, because they can't find the Class. The AppID for "Some Object" etc does exit.

The following Code does create a Win32_DCOMApplicationSetting Class, but the Class is missing something to override the a exition Class with the same AppID and therefore some thing ist missing. But no Errors are thrown.

$ApplicationSetting = ([wmiclass]'Win32_DCOMApplicationSetting').CreateInstance()

$ApplicationSetting.Caption = "Some Object"
$ApplicationSetting.AppID = "{someAppID}"
$ApplicationSetting.EnableAtStorageActivation=$false
$ApplicationSetting.UseSurrogate=$false
    
$descriptor = ([wmiclass]'Win32_SecurityDescriptor').CreateInstance()
$descriptor.ControlFlags = 32772

$trusteeObj = ([wmiclass]'Win32_Trustee').psbase.CreateInstance()
$trusteeObj.Domain = "NT AUTHORITY"
$trusteeObj.Name = "LOCAL SERVICE"


$ace = ([wmiclass]'Win32_ACE').psbase.CreateInstance()

$ace.AccessMask = 983103

$ace.Trustee = $trusteeObj

$descriptor.Owner = $trusteeObj
$descriptor.SetPropertyValue("DACL",@([System.Management.ManagementBaseObject]$ace))

$ApplicationSetting.SetConfigurationSecurityDescriptor($descriptor)

$restult = Set-WmiInstance -InputObject $ApplicationSetting
$restult

Thanks in advance for Suggestions or Ideas

Upvotes: 0

Views: 47

Answers (0)

Related Questions