Forum Discussion

rmerritt's avatar
rmerritt
Copper Contributor
Oct 31, 2024

How do I display a "Microsoft.ActiveDirectory.Management.ADPropertyValueCollection" using PowerShell

 

 

 

PS C:\Users\serveradmin.QA> Get-ADDomainController -Filter * | Select-Object Name, OperationMasterRoles |Where-Object {$_.OperationMasterRoles}

Name     OperationMasterRoles                                         
----     --------------------                                         
ADAICTQA {SchemaMaster, DomainNamingMaster, PDCEmulator, RIDMaster...}

 

 

 

 

in the above command I output OperationMasterRoles  Id like those to be displayed in the same row comma seperated ...how do I disect that ADPropertyValueCollection ?

  • LainRobertson's avatar
    LainRobertson
    Silver Contributor

    rmerritt 

     

    Hi, Rob.

     

    Get-ADDomainController -Filter { (operationMasterRoles -like "*") } | ForEach-Object {
        [PSCustomObject] @{
            name = $_.name;
            operationMasterRoles = $_.operationMasterRoles -join ",";
        }
    }

     

    Cheers,

    Lain

Resources