Thx a lot for finally moving away from Silverlight! We also managed to get the new console working on SCO 2019. It took a couple of days, though...
In order to get ready for SCO2022 as early as possible we need to know how to use the new Web API. We are Sys Admins rather than seasoned Developers and need some help with this.
We use an in-house built Visual Studio .Net Windows forms app to trigger Runbooks, We've been wondering if we can still use it with SCO2022 and or how much work it will be to rewrite the web service connection routines. It would be great if anyone could post a few examples on how to do this in Visual Studio via the new Web API. We specifically need to be able to trigger a Runbook (Create Job), query the status of the new Job and/or its Instances. Any help is appreciated!
Here is an example how it is currently is done using VB. However, examples in C# would be fine too:
Dim scorchSVC = New Microsoft.SystemCenter.Orchestrator.WebService.OrchestratorContext(New Uri("http://<SCO server FQDN>:81/orchestrator2012/orchestrator.svc")) With {
.Credentials = System.Net.CredentialCache.DefaultCredentials
}
Dim strRunbook As String
strRunbook = "Create AD User Account"
'retrieve Runbook
Dim runbooks = (From rbData In scorchSVC.Runbooks
Where rbData.Name = strRunbook).ToList()
'retrieve Runbook parameters
Dim runbookpars = (From rbData In scorchSVC.RunbookParameters
Where rbData.RunbookId = runbooks.Single().Id).ToList()
'initialize input paramaters
Dim input1param = (From rbData In runbookpars
Where rbData.Name = "Creator").Single()
Dim input2param = (From rbData In runbookpars
Where rbData.Name = "FirstName").Single()
Dim input3param = (From rbData In runbookpars
Where rbData.Name = "LastName").Single()
'etc........
'create parameter XML
Dim paramxml = New XDocument(
New XElement("Data",
New XElement("Parameter",
New XElement("Name", input1param.Name),
New XElement("ID", input1param.Id.ToString("B")),
New XElement("Value", strCreator)
),
New XElement("Parameter",
New XElement("Name", input2param.Name),
New XElement("ID", input2param.Id.ToString("B")),
New XElement("Value", strFirstName)
),
New XElement("Parameter",
New XElement("Name", input3param.Name),
New XElement("ID", input3param.Id.ToString("B")),
New XElement("Value", strLastName)
'etc.........
)))
'prepare Runbook job
Dim job = Microsoft.SystemCenter.Orchestrator.WebService.Job.CreateJob(System.Guid.NewGuid(), runbooks.Single().Id, GlobalVariables.StrLoginName, DateTime.Now, GlobalVariables.StrLoginName, DateTime.Now)
Dim strParam As String = paramxml.Document.ToString()
job.Parameters = strParam
scorchSVC.AddToJobs(job)
scorchSVC.SaveChanges()