WITH XMLNAMESPACES ('http://schemas.microsoft.com/SystemsCenterConfigurationManager/2009/07/10/DesiredConfiguration' as desconfig, DEFAULT 'http://schemas.microsoft.com/SystemCenterConfigurationManager/2009/AppMgmtDigest') Select distinct Apps.DisplayName, DT.DisplayName AS [DeploymentTypeName], DT.Technology ,fn.Name as [Location] --,PC.[Owner] ,PC.[Support Contact] --,PC.[Description] --,Apps.NumberOfDeploymentTypes --,Apps.HasContent --,DT.PriorityInLatestApp --,ISNULL(DT.SDMPackageDigest.value('(/AppMgmtDigest/DeploymentType/Installer/InstallAction/Args/Arg[@Name="Description"])[1]','nvarchar(MAX)'), 'None') AS [Decription] --,ISNULL(DT.SDMPackageDigest.value('(/AppMgmtDigest/DeploymentType/Installer/InstallAction/Args/Arg[@Name="InstallCommandLine"])[1]','nvarchar(MAX)'), 'None') AS [InstallCommand] --,ISNULL(DT.SDMPackageDigest.value('(/AppMgmtDigest/DeploymentType/Installer/UninstallAction/Args/Arg[@Name="InstallCommandLine"])[1]','nvarchar(MAX)'), 'None') AS [UninstallCommand] ,aa.CollectionName ,aa.AssignmentName From fn_ListApplicationCIs(1033) Apps Left Join fn_ListDeploymentTypeCIs(1033) DT ON DT.AppModelName = Apps.ModelName Left join vFolderMembers fm on apps.ModelName = fm.InstanceKey Left join vSMS_Folders fn on fm.ContainerNodeID = fn.ContainerNodeID LEFT JOIN ( Select ISNULL(Apps.SDMPackageDigest.value('(/AppMgmtDigest/Application/DisplayInfo/Info/Description)[1]','nvarchar(MAX)'), 'None') AS [Description] ,Apps.SDMPackageDigest.value('(/AppMgmtDigest/Application/Owners/User/@Id)[1]', 'nvarchar(MAX)') [Owner] ,Apps.SDMPackageDigest.value('(/AppMgmtDigest/Application/Contacts/User/@Id)[1]', 'nvarchar(MAX)') [Support Contact] ,Apps.CI_ID from fn_ListApplicationCIs(1033) Apps ) AS [PC] ON PC.CI_ID = Apps.CI_ID left join v_ApplicationAssignment aa on aa.ApplicationName = apps.DisplayName Where Apps.IsLatest = 1 AND DT.IsLatest = 1 AND HasContent = 1 AND PriorityInLatestApp = 1 AND (fm.ObjectTypeName = N'SMS_ApplicationLatest' ) and aa.AssignmentName is not null