Public/Invoke-CCMClientScheduleUpdate.ps1
Function Invoke-CCMClientScheduleUpdate { [cmdletbinding()] param( [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, ParameterSetName = 'ComputerName', Position = 0, Mandatory = $true)] [string[]]$ComputerName, [Parameter(ParameterSetName = 'CimSession')] [CimSession[]]$CimSession ) Begin { $taskHash = @{ '{00000000-0000-0000-0000-000000000003}' = 'Discovery Data Collection Cycle' '{00000000-0000-0000-0000-000000000001}' = 'Hardware Inventory Cycle' '{00000000-0000-0000-0000-000000000002}' = 'Software Inventory Cycle' '{00000000-0000-0000-0000-000000000021}' = 'Machine Policy Retrieval Cycle' '{00000000-0000-0000-0000-000000000022}' = 'Machine Policy Evaluation Cycle' '{00000000-0000-0000-0000-000000000113}' = 'Software Update Scan Cycle' '{00000000-0000-0000-0000-000000000108}' = 'Software Updates Assignments Evaluation Cycle' '{00000000-0000-0000-0000-000000000110}' = 'DCM policy' } $cimParam = @{ Namespace = 'root/ccm' Class = 'SMS_CLIENT' Name = 'TriggerSchedule' #ErrorAction = 'SilentlyContinue' } } Process { Switch -Regex ($PSCmdlet.ParameterSetName) { 'ComputerName' { $cimParam['ComputerName'] = $ComputerName } 'CimSession' { $cimParam['CimSession'] = $CimSession } } $taskHash.GetEnumerator() | ForEach-Object { Invoke-CimMethod @cimParam -Arguments @{ sScheduleID = $PSItem.GUID } } } } |