Share via


How to get SCCM Application deployment status

Question

Wednesday, December 9, 2015 2:19 PM

Hello,
I am facing an issue to retrieve the latest SCCM application deployment status info
after having updated the application content (right click on deployment type then 'update content')

here is the function I'm using :

function Get-DeplymentReport

{

  [CmdletBinding()]

  Param(

        [Parameter(Mandatory=$True)][string]$CollectionName,

        [Parameter(Mandatory=$True)][string]$appname

  )

    

  $appInfo = Get-CMDeployment -CollectionName $CollectionName |

             select  CollectionName, SoftwareName, NumberTargeted, NumberSuccess, NumberErrors, NumberInProgress, NumberOther, NumberUnknown, PackageID, CreationTime, ModificationTime, DeploymentTime, SummarizationTime # | ft -autosize #Out-GridView

  $appInfo  = $appInfo | where SoftwareName -eq $appname

 

  $appInfo

  if($appInfo.NumberSuccess -eq $null ){

   write-host " no information reported yet for' $appname '"

  }

  if(($appInfo.NumberTargeted -eq $appinfo.NumberSuccess) -and ( $appinfo.NumberSuccess -ne $null )) {

   write-host "$appname déployed with success"

  }

  if($appInfo.NumberSuccess -eq $appinfo.NumberErrors -eq  '0' ) {

   write-host "$appname no info in inventory yet"

  }

  if(($appInfo.NumberInProgress -gt 0 )) {

   write-host "$appname being deployed …"

  }

  if($appinfo.NumberErrors -ge 1){

   write-host "$appname déployed with at least " $appinfo.NumberErrors " failures"  $appinfo.NumberTargeted " machines"

  }

}

The issue is that this still return me all ok / all deployed if I update the SCCM application content ....

Thanks in advance.

MCTS Windows Server Virtualization, Configuration

All replies (3)

Wednesday, December 9, 2015 3:36 PM ✅Answered

"The issue is that this still return me all ok / all deployed if I update the SCCM application content ..."

Updating the content of a deployment type within an application does not affect the deployment of that application. Are you expecting the application to be re-deployed?

Jason | http://blog.configmgrftw.com | @jasonsandys


Tuesday, December 15, 2015 12:29 PM ✅Answered

It turns out that,
the SCCM 'guy' adviced me to update the content from the GUI
whenever I needed to modify the data being deployed by the application from the source directory...
and he said it will be deployed to clients.

Actually, if I follow his advice, Yes the new content will get deployed but the deployment status will not move from 100%... 
I had (in the script being prepared) to add a line that just 'removes' the deployment
from the collection

Remove-CMDeployment-ApplicationName  $appname-CollectionName$CollectionName-Force-ErrorActionSilentlyContinue 

and then of course just insert the line that deploys the app
(reattaches the deployment to the device collection) 

#deploy !!

Start-CMApplicationDeployment-CollectionName$CollectionName-Name$appname-DeployPurpose'Required'-TimeBaseOnLocalTime#-ErrorAction SilentlyContinue
that did actually reset the counters (Number success, Number Fails......)
wich allowed me to make my loops checking for the deployment results .....

Thanks.

MCTS Windows Server Virtualization, Configuration


Friday, December 11, 2015 1:23 PM

"The issue is that this still return me all ok / all deployed if I update the SCCM application content ..."

Updating the content of a deployment type within an application does not affect the deployment of that application. Are you expecting the application to be re-deployed?

Jason | http://blog.configmgrftw.com | @jasonsandys

Hi, my bad as I didn't described my need with the good terms,

I want to fully automate/script the deployment of a couple of applications by SCCM.

It is working fine but the issues I am facing is that it takes a lot of time for SCCM clients (rds hosts)
to report to the SCCM server after they end downloading / installing the app.
Wich means that my function (where I query status of the deployment from SCCM server) will return informations that do not reflect what is truly on the clients ....

I am using a powershell script as the detection method.
Where I have put a out-file ... Inside the different if() blocks .. to log and know from wich exit point
it ended ...

I'm thinking of inserting client actions triggering Inside (at the end of) the detection method script.
That way, (knowing that a sccm app's detection method is run both before app is installed and after),
it will force the client to report to the server immediately.

I'll be testing this ...

Thanks.

MCTS Windows Server Virtualization, Configuration