Orchestrator - Get Runbook GUIDs using PowerShell


So how do you start a Runbook using PowerShell?  This seems easy as Microsoft already provide some code Start a Runbook using PowerShell, but there is a catch.  To use the code, you must know the GUID of the Runbook and the parameters (if any).  So how do you get the MUST HAVE GUIDs?  I found multiple blogs that shows SQL query, Excel PowerPivot or else, but how to do it using PowerShell? 

I have created  2 simple PowerShell scripts: 
  - GetRunbookGUIDs.ps1
  - ListAllRunbookGUIDs.ps1

Download the script from the Script Center Repository here

This posting is provided "AS IS" with no warranties and confers no rights.

 

 

Comments (3)

  1. GetRunbookGUIDS will fail with powershell 2.0 says:

    Hell Denis,

    I'll get the error below running the script with powershell 2.0. (works well with 3.0)

    item : You cannot call a method on a null-valued expression.
    GetRunbookGUIDs.ps1:80 char:86 + $RbkGUID = $RunbookEntry.GetElementsByTagName("content").childNodes.childnodes.item <<<< (0).innerText

    -> Error Querying Orchestrator Web Service.
    getElementsByTagName : Method invocation failed because [System.String] doesn't contain a method named 'getElementsByTagName'.
    GetRunbookGUIDs.ps1:90 char:56
    + $ParamEntries = $runbookxmlparam.getElementsByTagName <<<< ('entry')
    + CategoryInfo : InvalidOperation: (getElementsByTagName:String) [], RuntimeException + FullyQualifiedErrorId : MethodNotFound

    any idea ?
    thanks a lot

    1. Geoff Young says:

      Same Exact error.

  2. Bikash Biswal says:

    Hi Denis,

    I am getting following error. Could you please help.

    -> Error Querying Orchestrator Web Service.
    Method invocation failed because [System.String] doesn't contain a method named 'getElementsByTagName'.
    At line:67 char:1
    + $RunbookEntries = $SCOxml.getElementsByTagName('entry')
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : MethodNotFound

    Method invocation failed because [System.String] doesn't contain a method named 'GetElementsByTagName'.
    At line:71 char:1
    + [int]$iTotRunbooks = $SCOxml.GetElementsByTagName('m:count').innertext
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : MethodNotFound

    #Runbooks returned: 0
    #Runbooks total:

Skip to main content