Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create-Subscriptions Target group issue #10

Open
PhilM-IT opened this issue Nov 6, 2017 · 1 comment
Open

Create-Subscriptions Target group issue #10

PhilM-IT opened this issue Nov 6, 2017 · 1 comment

Comments

@PhilM-IT
Copy link

PhilM-IT commented Nov 6, 2017

When you're not using the pre-defined target groups of "Domain Controllers" or "Domain Computers" the resulting subscription that's loaded can't be opened in the UI (error screen shot attached).

capture

This is because the resulting XML tag "AllowedSourceDomainComputers" ends up containing the name of the target group instead of the group SID. Adjusting the line in the script per below converts the group name to a SID and results in the problem being "fixed"

Default{$xmlWriter.WriteElementString("AllowedSourceDomainComputers","O:NSG:BAD:P(A;;GA;;;"+([System.Security.Principal.NTAccount]($Channel.TargetGroup)).Translate([System.Security.Principal.SecurityIdentifier]).Value+")S:")}

@SaintPaddy
Copy link

Very true. I did not even look at the GitHub Issues page when I had this issue, and fixed it like this on my test environment.
Looking at it, yours might be more elegant.

Switch ($Channel.TargetGroup){
"Domain Controllers" {$xmlWriter.WriteElementString("AllowedSourceDomainComputers","O:NSG:BAD:P(A;;GA;;;DD)S:")}
"Domain Computers" {$xmlWriter.WriteElementString("AllowedSourceDomainComputers","O:NSG:BAD:P(A;;GA;;;DC)S:")}
Default {
Import-Module ServerManager | Out-Null
Add-WindowsFeature RSAT-AD-PowerShell | Out-Null
Import-Module activedirectory | Out-Null
$TargetGroupSID = $(Get-ADGroup -Identity $($Channel.TargetGroup) | Select SID).SID.Value
$xmlWriter.WriteElementString("AllowedSourceDomainComputers","O:NSG:BAD:P(A;;GA;;;"+$TargetGroupSID+")S:")
}

It's a shame that after all these years the two issues posted have not been fixed by @russelltomkins Aside from that, nice repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants