Automating Group Creation (with Custom Attributes) and Device Relocation Rules

Solved
GG
Gerald Gilmore
Canadian Tire

I'm trying to find SOTI documentation on building a group with the following requirements:

1) Create a net new Device Group for a specific hardware type

2) Create a sub group for each Province in Canada

3) Create further sub groups for each location within each Province

4) Each group location must contain pre-defined Custom Attributes. Location #, language EN or FR etc.....

5) The Device Relocation Rules contain a specific IP address range and target a unique group

The above must exist in our Dev, QA and PROD environments.  Due to the volume of groups to be created, we are looking to automate this process and avoid creating thousands of manual tasks. 

I've seen some references to creating this using API calls, however I haven't found anything specific to what we need to create. 

6 years ago
SOTI MobiControl
ANSWERS
MD
Matt Dermody Diamond Contributor
6 years ago (edited 6 years ago)

The APIs are absolutely the way to go for what you're looking for from an automation perspective. Leveraging the APIs will require programming knowledge as you'll have to build something custom in order to leverage them but that makes sense given that this is a pretty custom request. The Device Group related APIs are very extensive in recent 14.x versions of MobiControl:

Solution
GG
Gerald Gilmore
6 years ago

Thanks Matt, we've done some basic work with API to retrieve data that doesn't exist in the standard 'canned' reports. 

I figured we'd need a program to loop through all the requests and in the end, I ended up reaching out to colleagues who have implemented something very similar in a seperate MobiControl environment. 

Going through the code now to see how it all works. 

GG
Gerald Gilmore
6 years ago

I've been doing some tests in our QA environment and although I can create individual groups through the MobiControl/api/ page, it seems like when modifying the scripts provided here (https://discussions.soti.net/thread/using-powershell-to-make-api-calls/) that the script in unable to request a token. 

The only modification I had to make was to change the https://$MCFQDN/Mobicontrol/api/devicegroups reference to http: as it was throwing an SSL/TLS error. 

Would something like this cause the token request process to fail? We are currently running MobiControl 13.4.0.4899

GG
Gerald Gilmore
6 years ago

Answering my own question right now, but regarding the ''The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel' error I was getting when running the PS script, I came across this post. 

https://alexandrebrisebois.wordpress.com/2014/09/05/powershell-invoke-restmethod-the-underlying-connection-was-closed/

Adding [System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true} at the top of the script allows it to talk to the MC server. 

Now I'm getting a 'The remote server returned an error: (401) Unauthorized' message so I'm working through this right now. 

I would like a template API for call the mobicontrol. Can you send link url for template ? thank you.

The APIs are absolutely the way to go for what you're looking for from an automation perspective. Leveraging the APIs will require programming knowledge as you'll have to build something custom in order to leverage them but that makes sense given that this is a pretty custom request. The Device Group related APIs are very extensive in recent 14.x versions of MobiControl:

GG
Gerald Gilmore
6 years ago