SCMDM 2008 – Web Services – EnrollmentAdmin

Following my previous introduction to web services in SCMDM; to start off with the walkthroughs I’ll attack the EnrollmentAdminService first. Provided you have not altered the default port settings it can be located at
https://FQDN:8445/MDM/EnrollmentAdminService/Admin.asmx
where FQDN is your enrollment server.

The following operations are available:
image

We’ll have a closer look at the following operations:
- GetConfiguration
- SetConfiguration
- NewEnrollmentRequest
- RemoveEnrollmentRequest

The other operations also serve a purpose, but not necessarily in this context. (Do you perform traces daily?) GetEnrollmentServiceLog is useful, but is also easy to do in Powershell.

GetConfiguration
Testing this in the browser we see that no parameters are required.
image

Resulting XML (excerpt):
image

It’s basically a more verbose version of the cmdlet Get-EnrollmentConfig:
image

SetConfiguration
Browsing to this operation we see another scenario:
image

This basically means – you cannot test this in your browser.

NewEnrollmentRequest
This operation cannot be tested in the browser either, but we can learn something from the SOAP definitions:
image

These are the fields we need to provided to create an enrollment, and yes, they are the same fields needed for running the Powershell cmdlet New-EnrollmentRequest:
image

RemoveEnrollmentRequest
Just as easily as we can create enrollments, we can remove them. This only applies to enrollments requests (not enrolled devices), and is another name for canceling an enrollment. (Maybe you made a typo or something when creating the original request.)

You may invoke this operation from the web browser provided you have all the necessary details available (I don’t perform base64-encoding as a mental exercise):
image

Monkey see, monkey code
Ok. Let’s have a look at how this will work out in our own program. I adjusted some design elements from the mock-up, and I have also filled in sample values:
image

I have not implemented the two “Browse”-buttons yet, so no screenshots, but the first one should let you browse for users, and the second for OUs/CNs. The Device OU field should ideally be populated with the default OU for devices. Enrollment Password and Enrollment Expires could actually be labels as they are read-only.

Here’s the code snippet for the “Create Pre-Enrollment Request”-button:
image

Hard-coding the url to the enrollment server is not very flexible, but it makes the sample shorter (as do the omission of a try-catch block). If you are wondering where the AdminEnrollService class came from I added the web service as a web reference. (I haven’t shown any details regarding creating the Visual Studio project, but I don’t know if there’s a demand for it, or if people will figure it out themselves.)

I did an additional “cheat” as well here. I am not authenticating in any way. But I am running on the server, as administrator, and therefore it will work anyway.

So, does this work? Well, here’s what it looks like after clicking the “Create…”-button:
image

Guess it worked then! (Will get around to using the status bar later to output “OK” or something.)

Let’s try removing the request as well. First through the web browser:
image

Resulting XML:
image

It does seem easy doesn’t it? But where did that base64 string come from? Well, when creating the pre-enrollment request a property called requestId is returned, so I catched this value in debug mode when creating the pre-enrollment and I pasted it into the web page.

Doing it in code would look like this:
image

GetConfiguration and SetConfiguration that I showed above aren’t really relevant to implement in coding. It’s easy to work it through Powershell, and I’ll leave it at that.

No, I didn’t include the code as images instead of providing text you can copy-paste just to be cruel. It looks better, and is easier for me, since I have some problems with the plug-in for syntax highlighting. It’s not large amounts of code to type though, and I might attach some source files later.

I hope you’re still following me (and enjoying the ride) – there’s still more web services to come :)

There are no responses yet

Leave a Reply

RSS for Posts RSS for Comments