I was recently asked to get a list of all Distribution Points in a specific Distribution Point Group. Now I knew I could just copy out of the console but where is the fun in that? You have to be able to do this with a Powershell one-liner right? Queue 10 minutes later and voila! (OK you’re right. It did take longer than 10 minutes) Here is how I did it.
The group name isDPG Alpha so I started with Get-CMDistributionPointGroup.
PS CNT:\> Get-CMDistributionPointGroup -Name 'DPG Alpha'
SmsProviderObjectPath : SMS_DistributionPointGroup.GroupID="{XXXXXXX-XXXXXXX-XXXXXXX}"
CollectionCount : 0
ContentCount : 50
ContentInSync : True
CreatedBy : contoso\21303
CreatedOn : 4/11/2018 12:44:16 PM
Description : This is the Production Distribution Point Group.
GroupID : {XXXXXXX-XXXXXXX-XXXXXXX}
HasMember : True
HasRelationship : False
MemberCount : 10
ModifiedBy : contoso\21303
ModifiedOn : 4/17/2019 12:44:16 PM
Name : DPG Alpha
OutOfSyncContentCount : 0
SourceSite : CNT
We need the members of the DPG Alpha group so I piped in Get-CMDistributionPoint.
PS CNT:\> Get-CMDistributionPointGroup -Name "DPG Alpha" | Get-CMDistributionPoint
…
NetworkOSPath : \\DPG1.CNT.NET
PropLists : {BindExcept, Objects Polled By Site Status, Protected Boundary, SourceDistributionPoints...}
Props : {ADSiteName, AllowInternetClients, AvailableContentLibDrivesList, AvailablePkgShareDrivesList...}
RoleCount : 2
RoleName : SMS Distribution Point
ServerState : 196611
ServiceWindows :
SiteCode : CNT
SiteSystemStatus : 1
SslState : 0
Type : 8
Since we don’t care about anything other than the hostname, I limited the script to only the NetworkOSPath.
PS CNT:\> Get-CMDistributionPointGroup -Name "DPG Alpha" | Get-CMDistributionPoint | foreach { $_.NetworkOSPath }
\\DPG1.CNT.NET
\\DPG2.CNT.NET
\\DPG3.CNT.NET
\\DPG4.CNT.NET
\\DPG5.CNT.NET
Now we are getting somewhere. Just to make it cleaner, let’s get rid of the leading slashes.
PS CNT:\> (Get-CMDistributionPointGroup -Name "DPG Alpha" | Get-CMDistributionPoint | foreach { $_.NetworkOSPath }).Substring(2)
DPG1.CNT.NET
DPG2.CNT.NET
DPG3.CNT.NET
DPG4.CNT.NET
DPG5.CNT.NET
And just in case you don’t want the FQDN…let’s drop the domain too.
PS CNT:\> (Get-CMDistributionPointGroup -Name "DPG Alpha" | Get-CMDistributionPoint | foreach { $_.NetworkOSPath }).Substring(2) -replace ".CNT.NET"
DPG1
DPG2
DPG3
DPG4
DPG5
Of course you could export that to a CSV but this worked for me.