I've made a script that runs in our Client Deployment cycle after our task sequence, where packages and applications are being installed. However, we noticed that it took a long time to finish, as most programs are in the evalutationState 26 (Download success (downloading during install job)). I want to force the installation of the programs, that essentially are in this state, so that it doesn't take ages to complete.
I've had a look MS Docs regarding installing ccm applications (https://learn.microsoft.com/en-us/mem/configmgr/develop/reference/core/clients/sdk/install-method-in-class-ccm_application?redirectedfrom=MSDN), and made the following:
$applications = get-wmiobject -query "SELECT * FROM CCM_Application" -namespace "ROOT\ccm\ClientSDK" | Select-Object FullName, InstallState, EvaluationState, ErrorCode, Id, Revision, IsMachineTarget
$appID = $applications.ID
$appRevision = $applications.Revision
$appMachineTarget = $applications.IsMachineTarget
try
{
# Documentation MS Docs - https://learn.microsoft.com/en-us/mem/configmgr/develop/reference/core/clients/sdk/install-method-in-class-ccm_application?redirectedfrom=MSDN
([WmiClass]'Root\CCM\ClientSDK:CCM_Application').Install($appID, $appRevision, $appMachineTarget, 0, "Normal", $false) | Out-Null -ErrorAction Stop
}
catch [Exception]
{
$errorMessage = $_.Exception
Write-Log "Failed to start the installation. Reason: $errorMessage"
}
However, when logging in the log file, I can see that I catch an exception:
[17:04:31] : Trying to force installation of Citrix Netscaler Access Gateway 13.0.84.11 en-US
[17:04:31] : Failed to start the installation. Reason: System.Runtime.InteropServices.COMException (0x80040E14) at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Management.ManagementObject.InvokeMethod(String methodName, ManagementBaseObject inParameters, InvokeMethodOptions options)
at System.Management.Automation.ManagementClassApdapter.InvokeManagementMethod(ManagementObject wmiObject, String methodName, ManagementBaseObject inParams)
I tried having a look at this post (Install SCCM packages with PowerShell), but the answer:
Get-WmiObject -Class CCM_Program -Namespace "root\ccm\clientsdk"
doesn't bring up the same applications as CCM_Application
Any help is appreciated! Thanks in advance