Untitled

 avatar
unknown
plain_text
2 months ago
1.1 kB
4
Indexable
# Define the registry path for DCOM permissions
$regPath = "HKLM:\SOFTWARE\Microsoft\Ole"

# Get the current ACL for the registry key
$acl = Get-Acl $regPath

# Define the access rule for NETWORK SERVICE
$accessRule = New-Object System.Security.AccessControl.RegistryAccessRule(
    "NETWORK SERVICE", 
    "FullControl", 
    "Allow"
)

# Add the access rule to the ACL
$acl.AddAccessRule($accessRule)

# Apply the updated ACL to the registry key
Set-Acl -Path $regPath -AclObject $acl

-----

# Define the registry key for DCOM security
$registryKeyPath = "HKLM:\SOFTWARE\Microsoft\Ole"
$acl = Get-Acl -Path $registryKeyPath

# Define the permission for NETWORK SERVICE
$permission = "NETWORK SERVICE","Read","Allow"

# Convert to Access Rule
$accessRule = New-Object System.Security.AccessControl.RegistryAccessRule($permission[0], $permission[1], "None", "None", "Allow")

# Add the access rule to the ACL
$acl.AddAccessRule($accessRule)

# Set the new ACL to the registry key
Set-Acl -Path $registryKeyPath -AclObject $acl
Editor is loading...
Leave a Comment