/* Return a list of systems that have not completed deployment of a given application */ Declare @Title varchar(max) -- application title Set @Title='%(SEP)%5323%' select VRSV.Netbios_Name0 as 'Netbios Name' , vAA.CollectionName as 'Target Collection' , Vaa.ApplicationName as 'Application Name' , VADTDRPC.Descript as 'Deployment Type' , VCI.LastEnforcementMessageTime --, VCI.LastErrorCode --, VADTDRPC.AppEnforcementState ,case when VADTDRPC.AppEnforcementState = 1000 then 'Success' when VADTDRPC.AppEnforcementState = 1001 then 'Already Compliant' when VADTDRPC.AppEnforcementState = 1002 then 'Simulate Success' when VADTDRPC.AppEnforcementState = 2000 then 'In Progress' when VADTDRPC.AppEnforcementState = 2001 then 'Waiting for Content' when VADTDRPC.AppEnforcementState = 2002 then 'Installing' when VADTDRPC.AppEnforcementState = 2003 then 'Restart to Continue' when VADTDRPC.AppEnforcementState = 2004 then 'Waiting for maintenance window' when VADTDRPC.AppEnforcementState = 2005 then 'Waiting for schedule' when VADTDRPC.AppEnforcementState = 2006 then 'Downloading dependent content' when VADTDRPC.AppEnforcementState = 2007 then 'Installing dependent content' when VADTDRPC.AppEnforcementState = 2008 then 'Restart to complete' when VADTDRPC.AppEnforcementState = 2009 then 'Content downloaded' when VADTDRPC.AppEnforcementState = 2010 then 'Waiting for update' when VADTDRPC.AppEnforcementState = 2011 then 'Waiting for user session reconnect' when VADTDRPC.AppEnforcementState = 2012 then 'Waiting for user logoff' when VADTDRPC.AppEnforcementState = 2013 then 'Waiting for user logon' when VADTDRPC.AppEnforcementState = 2014 then 'Waiting to install' when VADTDRPC.AppEnforcementState = 2015 then 'Waiting retry' when VADTDRPC.AppEnforcementState = 2016 then 'Waiting for presentation mode' when VADTDRPC.AppEnforcementState = 2017 then 'Waiting for Orchestration' when VADTDRPC.AppEnforcementState = 2018 then 'Waiting for network' when VADTDRPC.AppEnforcementState = 2019 then 'Pending App-V Virtual Environment' when VADTDRPC.AppEnforcementState = 2020 then 'Updating App-V Virtual Environment' when VADTDRPC.AppEnforcementState = 3000 then 'Requirements not met' when VADTDRPC.AppEnforcementState = 3001 then 'Host platform not applicable' when VADTDRPC.AppEnforcementState = 4000 then 'Unknown' when VADTDRPC.AppEnforcementState = 5000 then 'Deployment failed' when VADTDRPC.AppEnforcementState = 5001 then 'Evaluation failed' when VADTDRPC.AppEnforcementState = 5002 then 'Deployment failed' when VADTDRPC.AppEnforcementState = 5003 then 'Failed to locate content' when VADTDRPC.AppEnforcementState = 5004 then 'Dependency installation failed' when VADTDRPC.AppEnforcementState = 5005 then 'Failed to download dependent content' when VADTDRPC.AppEnforcementState = 5006 then 'Conflicts with another application deployment' when VADTDRPC.AppEnforcementState = 5007 then 'Waiting retry' when VADTDRPC.AppEnforcementState = 5008 then 'Failed to uninstall superseded deployment type' when VADTDRPC.AppEnforcementState = 5009 then 'Failed to download superseded deployment type' when VADTDRPC.AppEnforcementState = 5010 then 'Failed to updating App-V Virtual Environment' when VADTDRPC.AppEnforcementState is null then 'No results reported' Else 'Unknown Response' End as 'State Message' from vAppDTDeploymentResultsPerClient VADTDRPC join v_R_System_Valid VRSV on VRSV.ResourceID = VADTDRPC.ResourceID join v_ApplicationAssignment vAA on vAA.CollectionID = VADTDRPC.CollectionID left join v_CICurrentComplianceStatus vCI on vCI.CI_ID = VADTDRPC.CI_ID AND vCI.ResourceID = VRSV.ResourceID where Vaa.ApplicationName like @Title and AppEnforcementState not like '100%' --and VRSV.Netbios_Name0 = '' order by vrsv.Netbios_Name0, VADTDRPC.AppEnforcementState