Pete Hinchley: List the Content Assigned to an SCCM Distribution Point Group

A short PowerShell code snippet for listing the names of the content (packages and applications) assigned to an SCCM 2012 distribution point.

$sitecode  = 'LAB'
$provider  = 'SCCM'
$groupname = 'All DPs'
$namespace = "root\sms\site_$sitecode"

$id = (gwmi -n $namespace -query "select * from sms_distributionpointgroup where name='$groupname'" -comp $provider).groupid
gwmi -n $namespace -query "select * from sms_dpgroupcontentinfo where groupid='$id'" -comp $provider | sort name | select -expand name

The $provider variable is the name of the server hosting the SMS Provider, and the $groupname variable identifies the name of the distribution group to be queried.