none
schedule runbook error

    Question

  • I'm trying to set up scheduled runbooks using task scheduler and am using OrchestratorServiceModule module however it keeps coming back with errors:

     
    You cannot call a method on a null-valued expression.
    At L:\Scripts\_SCORCH_MODULE\1\OrchestratorServiceModule.psm1:269 char:9
    +         $parameternodes = $parametersxml.Item("Data").SelectNodes("Parameter")
    +         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
        + FullyQualifiedErrorId : InvokeMethodOnNull
    
    You cannot call a method on a null-valued expression.
    At L:\Scripts\_SCORCH_MODULE\1\OrchestratorServiceModule.psm1:269 char:9
    +         $parameternodes = $parametersxml.Item("Data").SelectNodes("Parameter")
    +         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
        + FullyQualifiedErrorId : InvokeMethodOnNull
    
    You cannot call a method on a null-valued expression.
    At L:\Scripts\_SCORCH_MODULE\1\OrchestratorServiceModule.psm1:269 char:9
    +         $parameternodes = $parametersxml.Item("Data").SelectNodes("Parameter")
    +         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
        + FullyQualifiedErrorId : InvokeMethodOnNull
    
    You cannot call a method on a null-valued expression.
    At L:\Scripts\_SCORCH_MODULE\1\OrchestratorServiceModule.psm1:269 char:9
    +         $parameternodes = $parametersxml.Item("Data").SelectNodes("Parameter")
    +         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
        + FullyQualifiedErrorId : InvokeMethodOnNull
    
    You cannot call a method on a null-valued expression.
    At L:\Scripts\_SCORCH_MODULE\1\OrchestratorServiceModule.psm1:269 char:9
    +         $parameternodes = $parametersxml.Item("Data").SelectNodes("Parameter")
    +         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
        + FullyQualifiedErrorId : InvokeMethodOnNull
    
    You cannot call a method on a null-valued expression.
    At L:\Scripts\_SCORCH_MODULE\1\OrchestratorServiceModule.psm1:269 char:9
    +         $parameternodes = $parametersxml.Item("Data").SelectNodes("Parameter")
    +         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
        + FullyQualifiedErrorId : InvokeMethodOnNull
    
    You cannot call a method on a null-valued expression.
    At L:\Scripts\_SCORCH_MODULE\1\OrchestratorServiceModule.psm1:269 char:9
    +         $parameternodes = $parametersxml.Item("Data").SelectNodes("Parameter")
    +         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
        + FullyQualifiedErrorId : InvokeMethodOnNull
    
    You cannot call a method on a null-valued expression.
    At L:\Scripts\_SCORCH_MODULE\1\OrchestratorServiceModule.psm1:269 char:9
    +         $parameternodes = $parametersxml.Item("Data").SelectNodes("Parameter")
    +         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
        + FullyQualifiedErrorId : InvokeMethodOnNull
    
    You cannot call a method on a null-valued expression.
    At L:\Scripts\_SCORCH_MODULE\1\OrchestratorServiceModule.psm1:269 char:9
    +         $parameternodes = $parametersxml.Item("Data").SelectNodes("Parameter")
    +         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
        + FullyQualifiedErrorId : InvokeMethodOnNull
    
    You cannot call a method on a null-valued expression.
    At L:\Scripts\_SCORCH_MODULE\1\OrchestratorServiceModule.psm1:269 char:9
    +         $parameternodes = $parametersxml.Item("Data").SelectNodes("Parameter")
    +         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
        + FullyQualifiedErrorId : InvokeMethodOnNull
    
    You cannot call a method on a null-valued expression.
    At L:\Scripts\_SCORCH_MODULE\1\OrchestratorServiceModule.psm1:269 char:9
    +         $parameternodes = $parametersxml.Item("Data").SelectNodes("Parameter")
    +         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
        + FullyQualifiedErrorId : InvokeMethodOnNull
    
    

    Here's the script I'm using:

    # Import the SCORCH module
    Import-Module 'L:\Scripts\_SCORCH_MODULE\1\OrchestratorServiceModule.psm1'
    
    # Set URL for web service
    $scorh_url = "http://orchestrator:81/Orchestrator2012/Orchestrator.svc/"
    
    # Set Folder Path for Runbook Folder
    $runbook_folder = '\Scheduled\5 min\'
    
    # Get all runbooks within the Daily folder
    $runbooks = Get-OrchestratorRunbook -ServiceUrl $scorh_url -RunbookPath $runbook_folder
    
    # Run through them and start each one
    foreach ($runbook in $runbooks)
    {
        # Get the runbook object
        $runbook_temp = Get-OrchestratorRunbook -ServiceUrl $scorh_url -RunbookId $runbook.Id
    
        # Now start the runbook
        Start-OrchestratorRunbook -Runbook $runbook_temp
    }
    
    # Output error log
    $error | out-file "L:\logs\error_DailyRunbooks.txt"
    
    # Output identity
    whoami | out-file "L:\logs\identity_DailyRunbooks.txt"


    Wednesday, March 15, 2017 6:57 AM

All replies

  • Hello,
    The Runbook server which is executing the Runbook does not contain the file.

    If you want to specify a Runbook server to run the runbook, pls see the below link. 
    https://technet.microsoft.com/en-us/library/hh403973(v=sc.12).aspx

    This should help. 
    Regards

    Priyabrata

    Wednesday, March 15, 2017 8:48 AM
  • I only have 1 server which contains all the roles. 
    Wednesday, March 15, 2017 9:01 AM
  • Hello there,

    I have tested your script. This will only either start Monitors or Runbooks without any initialized data. 

    Since your Runbooks have initialized data, you cannot Run the Script without passing values to it. 

    Regards


    Priyabrata

    Thursday, March 16, 2017 2:13 AM