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

Schemamaster Role is always $false #2

Open
HCRitter opened this issue Oct 24, 2022 · 2 comments
Open

Schemamaster Role is always $false #2

HCRitter opened this issue Oct 24, 2022 · 2 comments

Comments

@HCRitter
Copy link

When executing the script: https://github.com/jeremyts/ActiveDirectoryDomainServices/blob/master/Audit/New-ADAssetReport.ps1
The Schemamaster is always false, checked on several environments.

The problem is the following Code Segement:

if ($GCNames -match $DC.Name) { $IsGC = $true } if ($DC.Roles -match 'RidRole') { $IsRidMaster = $true } if ($DC.Roles -match 'PdcRole') { $IsPdcMaster = $true } if ($DC.Roles -match 'InfrastructureRole') { $IsInfraMaster = $true } if ($DC.Roles -match 'SchemaRole') { $IsSchemaMaster = $true } if ($DC.Roles -match 'NamingRole') { $IsNamingMaster = $true }

Using -match is causing the issue, while using -contains solves this.
This happens because .Roles is an enum object and SchemaRole is the first entry which is at index 0.

@jeremyts
Copy link
Owner

jeremyts commented Oct 24, 2022 via email

@HCRitter
Copy link
Author

Thanks for mentioning. Raised an issue there as well by now.

Maybe you want to fix these for your repo also :)

Best regards
Christian

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