The following Get-WMIObject query will return all Task Sequences that are deployed against a device in ConfigMgr 2012.

Feed in a variables.

$ResourceName = 'targeted device'
$SiteServer = 'hostname of the site server'
$SiteCode '3 digit site code'

Then run the following command:

Get-WMIObject -ComputerName $SiteServer -Namespace root/SMS/site_$SiteCode-Query "SELECT di.* FROM SMS
_FullCollectionMembership fcm, SMS_DeploymentInfo di WHERE fcm.Name = '$ResourceName' and di.TargetSecurityTypeID = '20
' and di.CollectionID = fcm.CollectionID"

Advertisements