First I love this tool!!! It has become our standard in cm12 app deployments, at least where complex apps are needed.
Been looking over the appdeploytoolkitmain.ps1 file for the new release 3.5.0 (I do this before I upgrade my systems) and I found that there were a couple of items from the invoke-sccmtask section that may no longer be needed (can't run them with sendschedule.exe) and a couple that were missing.
Here is my updated section of the script:
Function Invoke-SCCMTask {
<#
.SYNOPSIS
.LINK
Been looking over the appdeploytoolkitmain.ps1 file for the new release 3.5.0 (I do this before I upgrade my systems) and I found that there were a couple of items from the invoke-sccmtask section that may no longer be needed (can't run them with sendschedule.exe) and a couple that were missing.
Here is my updated section of the script:
Function Invoke-SCCMTask {
<#
.SYNOPSIS
Triggers SCCM to invoke the requested schedule task id.
.DESCRIPTIONTriggers SCCM to invoke the requested schedule task id.
.PARAMETER ScheduleIdSchedule Id.
.PARAMETER ContinueOnErrorContinue if an error is encountered.
.EXAMPLEInvoke-SCCMTask 'SoftwareUpdatesScan'
.EXAMPLEInvoke-SCCMTask
.NOTES.LINK
http://psappdeploytoolkit.codeplex.com
>
[CmdletBinding()]
Param (
[Parameter(Mandatory=$true)]
<#[ValidateSet('HardwareInventory','SoftwareInventory','HeartbeatDiscovery','SoftwareInventoryFileCollection','RequestMachinePolicy','EvaluateMachinePolicy','LocationServicesCleanup','SoftwareMeteringReport','SourceUpdate','PolicyAgentCleanup','RequestMachinePolicy2','CertificateMaintenance','PeerDistributionPointStatus','PeerDistributionPointProvisioning','ComplianceIntervalEnforcement','SoftwareUpdatesAgentAssignmentEvaluation','UploadStateMessage','StateMessageManager','SoftwareUpdatesScan','AMTProvisionCycle')]#>
[ValidateSet('HardwareInventory','SoftwareInventory','HeartbeatDiscovery','SoftwareInventoryFileCollection','RequestMachinePolicy','EvaluateMachinePolicy','LocationServicesCleanup','SoftwareMeteringReport','SourceUpdate','PolicyAgentCleanup','RequestMachinePolicy2','CertificateMaintenance','SoftwareUpdatesAgentAssignmentEvaluation','UploadStateMessage','StateMessageManager','SoftwareUpdatesScan','UpdateStorePolicy','StateSystemBulkSend','AMTProvisionCycle','ApplicationManagerPolicyAction','PowerManagementStartSummeraizer')]
[string]$ScheduleID,
[Parameter(Mandatory=$false)]
[ValidateNotNullorEmpty()]
[boolean]$ContinueOnError = $true
)
Begin {
## Get the name of this function and write header
[string]${CmdletName} = $PSCmdlet.MyInvocation.MyCommand.Name
Write-FunctionHeaderOrFooter -CmdletName ${CmdletName} -CmdletBoundParameters $PSBoundParameters -Header
[hashtable]$ScheduleIds = @{
HardwareInventory = '{00000000-0000-0000-0000-000000000001}'; # Hardware Inventory Collection Task
SoftwareInventory = '{00000000-0000-0000-0000-000000000002}'; # Software Inventory Collection Task
HeartbeatDiscovery = '{00000000-0000-0000-0000-000000000003}'; # Heartbeat Discovery Cycle
SoftwareInventoryFileCollection = '{00000000-0000-0000-0000-000000000010}'; # Software Inventory File Collection Task
RequestMachinePolicy = '{00000000-0000-0000-0000-000000000021}'; # Request Machine Policy Assignments
EvaluateMachinePolicy = '{00000000-0000-0000-0000-000000000022}'; # Evaluate Machine Policy Assignments
RefreshDefaultMp = '{00000000-0000-0000-0000-000000000023}'; # Refresh Default MP Task
RefreshLocationServices = '{00000000-0000-0000-0000-000000000024}'; # Refresh Location Services Task
LocationServicesCleanup = '{00000000-0000-0000-0000-000000000025}'; # Location Services Cleanup Task
SoftwareMeteringReport = '{00000000-0000-0000-0000-000000000031}'; # Software Metering Report Cycle
SourceUpdate = '{00000000-0000-0000-0000-000000000032}'; # Source Update Manage Update Cycle
PolicyAgentCleanup = '{00000000-0000-0000-0000-000000000040}'; # Policy Agent Cleanup Cycle
RequestMachinePolicy2 = '{00000000-0000-0000-0000-000000000042}'; # Request Machine Policy Assignments
CertificateMaintenance = '{00000000-0000-0000-0000-000000000051}'; # Certificate Maintenance Cycle
#PeerDistributionPointStatus = '{00000000-0000-0000-0000-000000000061}'; # Peer Distribution Point Status Task
#PeerDistributionPointProvisioning = '{00000000-0000-0000-0000-000000000062}'; # Peer Distribution Point Provisioning Status Task
#ComplianceIntervalEnforcement = '{00000000-0000-0000-0000-000000000071}'; # Compliance Interval Enforcement
SoftwareUpdatesAgentAssignmentEvaluation = '{00000000-0000-0000-0000-000000000108}'; # Software Updates Agent Assignment Evaluation Cycle
UploadStateMessage = '{00000000-0000-0000-0000-000000000111}'; # Send Unsent State Messages
StateMessageManager = '{00000000-0000-0000-0000-000000000112}'; # State Message Manager Task
SoftwareUpdatesScan = '{00000000-0000-0000-0000-000000000113}'; # Force Update Scan
UpdateStorePolicy = '{00000000-0000-0000-0000-000000000114}'; # Update Store Policy
StateSystemBulkSend = '{00000000-0000-0000-0000-000000000116}'; # State System Policy bulk send low
AMTProvisionCycle = '{00000000-0000-0000-0000-000000000120}'; # AMT Provision Cycle
ApplicationManagerPolicyAction = '{00000000-0000-0000-0000-000000000121}'; # Application Manager Policy Action
PowerManagementStartSummeraizer = '{00000000-0000-0000-0000-000000000131}'; # Power Management Start Summarizer
}
}
Process {
Write-Log -Message "Invoke SCCM Schedule Task ID [$ScheduleId]..." -Source ${CmdletName}
## Trigger SCCM task
Try {
[System.Management.ManagementClass]$SmsClient = [WMIClass]'ROOT\CCM:SMS_Client'
$SmsClient.TriggerSchedule($ScheduleIds.$ScheduleID) | Out-Null
}
Catch {
Write-Log -Message "Failed to trigger SCCM Schedule Task ID [$($ScheduleIds.$ScheduleId)]. `n$(Resolve-Error)" -Severity 3 -Source ${CmdletName}
If (-not $ContinueOnError) {
Throw "Failed to trigger SCCM Schedule Task ID [$($ScheduleIds.$ScheduleId)]: $($_.Exception.Message)"
}
}
}
End {
Write-FunctionHeaderOrFooter -CmdletName ${CmdletName} -Footer
}
}