Runbook not following selection routes

TBingeman 81 Reputation points
2021-11-19T01:00:00.99+00:00

I am having trouble getting this runbook to follow the steps I need it to follow and am hoping someone can help me. This series of runbooks is set up to call individual runbooks to help in remediating Windows update issues within our environment. When I test this series, it never picks up that there are updates that need to be installed even though the variable I am calling plainly states that there are updates to install. Any help with this will be greatly appreciated. I am including a link to the exported runbook series folder here.

s!Ass_N3Yy_kFhwEYaaieg9jKvBz8G

@Stefan Horz Any chance you can help me with this one?

System Center Orchestrator
System Center Orchestrator
A family of System Center products that provide an automation platform for orchestrating and integrating both Microsoft and non-Microsoft IT tools.
205 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Stefan Horz 3,081 Reputation points
    2021-11-28T19:53:35.37+00:00

    Hi @TBingeman ,

    sorry that I noticed posts here not earlier ...
    You are asking for activity "Determine steps" in Runbook "Update Automation Help Work"?

    A part of you code:

    $UpdatesNotInstalled = Invoke-Command -ComputerName \`d.T.~Ed/{2DA5304F-1DEA-47E4-B02B-A7728201DD34}.{AB2CA990-9B21-4423-A249-02973DFE81C1}\`d.T.~Ed/ -ErrorAction silentlycontinue -SessionOption (New-PSSessionOption -IncludePortInSPN) -ScriptBlock{  
    	$UpdatesNotInstalled = @(get-wmiobject -query "SELECT * FROM CCM_SoftwareUpdate" -namespace "ROOT\ccm\ClientSDK").count  
    	return $UpdatesNotInstalled  
    }  
    
    
    
    $UpdatesNotInstalled = Invoke-Command -ComputerName \`d.T.~Ed/{2DA5304F-1DEA-47E4-B02B-A7728201DD34}.{AB2CA990-9B21-4423-A249-02973DFE81C1}\`d.T.~Ed/ -ScriptBlock{  
    	$UpdatesNotInstalled = @(get-wmiobject -query "SELECT * FROM CCM_SoftwareUpdate" -namespace "ROOT\ccm\ClientSDK").count  
    	return $UpdatesNotInstalled  
    }  
    

    Perhaps it is better to add or compare $UpdatesNotInstalled because the second will overwrite the first (?).
    In the first you use "-ErrorAction silentlycontinue", so you get no error if it fails.
    Does the code above work in Powershell ISE if you ty a fix ComputerName from the list in the code instead of the published data?

    Regards,
    Stefan


  2. Stefan Horz 3,081 Reputation points
    2021-12-06T20:44:46.613+00:00

    Hi @TBingeman ,

    if you use this to get the UpdatesNotInstalled in a "Run .Net Script" Activity

    $ComputerName = 'NameOfComputerInlist'  
    $UpdatesNotInstalled = (Get-WmiObject -ComputerName $ComputerName -Query "SELECT * FROM CCM_SoftwareUpdate" -namespace "ROOT\ccm\ClientSDK").count  
    

    and if you publish UpdatesNotInstalled in thenDatabus, do you get a valid result?

    Regards,
    Stefan