Runbook Server
Applies To: System Center 2012 - Orchestrator, System Center 2012 R2 Orchestrator, System Center 2012 SP1 - Orchestrator
The Runbook Server entity represents an Orchestrator runbook server. The Runbook Servers collection includes all of the runbook servers installed on the local Orchestrator environment.
Properties
The following table lists the properties of the RunbookServer entity.
Name | Type | Key | Description |
---|---|---|---|
Id |
GUID |
Yes |
Unique identifier of the runbook. |
Name |
String |
No |
Name of the runbook server. |
Relationships
The following table lists the entities that share a relationship with the RunbookServer entity and the key property in each entity used to define the relationship.
Collection | Entity | Relationship | Related Entity Property | RunbookServer Entity Property |
---|---|---|---|---|
Events |
Event |
Child |
RunbookServerId |
Id |
Instances |
RunbookInstance |
Child |
RunbookServerId |
Id |
Jobs |
Job |
Child |
RunbookServerId |
Id |
Code Samples
Getting Runbook Servers using C#
The following code retrieves runbook all servers using C#. You can uncomment the line that specifies alternate credentials if the current user does not have appropriate permissions to the runbook being started. For more information see Programming in Visual Studio With the Orchestrator Web Service and Authentication and Authorization.
namespace CodeSample.Microsoft.SystemCenter.Orchestration.WebService
{
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.IO;
using System.Data.Services.Client;
using SCO.SCOService;
public class RunbookServers
{
public static void Main()
{
// Path to Orchestrator web service
string serviceRoot = "http://server01.contoso.com:81/Orchestrator2012/Orchestrator.svc";
// Create Orchestrator context
SCOService.OrchestratorContext context = new SCOData.OrchestratorContext(new Uri(serviceRoot));
// Set credentials to default or to a specific user.
context.Credentials = System.Net.CredentialCache.DefaultCredentials;
//context.Credentials = new System.Net.NetworkCredential("user", "pwd", "domain");
// Retrieve the runbook servers collection
IEnumerable<RunbookServer> runbookServers = context.RunbookServers.Execute();
// Display properties for each runbook server
foreach (RunbookServer runbookServer in runbookServers)
{
Console.WriteLine("Id = {0}, Name = {1}",
runbookServer.Id,
runbookServer.Name);
}
}
}
}
Getting Runbook Servers using Windows PowerShell
The following code retrieves all runbook servers using Windows PowerShell. You can uncomment the line that specifies alternate credentials if the current user does not have appropriate permissions to the runbook being started. For more information see Authentication and Authorization.
# Create the request object
$url = "http://server01.contoso.com:81/Orchestrator2012/Orchestrator.svc/RunbookServers")
$request = [System.Net.HttpWebRequest]::Create($url)
# Set the credentials to default or prompt for credentials
$request.UseDefaultCredentials = $true
# $request.Credentials = Get-Credential
# Build the request header
$request.Method = "GET"
$request.UserAgent = "Microsoft ADO.NET Data Services"
# Get the response from the request
[System.Net.HttpWebResponse] $response = [System.Net.HttpWebResponse] $Request.GetResponse()
# Write the HttpWebResponse to String
$reader = [IO.StreamReader] $response.GetResponseStream()
$output = $reader.ReadToEnd()
[xml]$output = $output
$reader.Close()
# Output properties of each activity
foreach ($runbookServer in $output.feed.entry)
{
Write-Host "Id: " $runbookServer.content.properties.Id.InnerText
Write-Host "Name: " $runbookServer.content.properties.Name
}
See Also
Concepts
Programming Using the Orchestrator Web Service
OData Queries Using the Orchestrator Web Service