PowerShell Cmdlets for MobiControl API
Use Get-Help [functionname or scriptname] -full
to checkout parameters and how to use.
Save the .psm in one of the module paths. Check the paths with the variable $env:PSModulePath
If your Server doesn't have a certificate you need to run Set-TrustAllCertsPolicy
first.
Follow the instructions of the API to create the clientID and client secret.
yourserver/MobiControl/api/docs/index#/
#Local user in MobiControl
$MCUsername = "Username"
$MCPassword = "Password"
#MobiControl Server
$MCFQDN = "Server"
#Client
$ClientID = "ClientID"
$Clientsecret = "Secret"
$token = Get-MCToken -MCUsername $MCUsername -MCPassword $MCPassword -MCFQDN $MCFQDN -ClientID $ClientID -ClientSecret $Clientsecret
Get-MCDeviceGroup -Token $token -Path "\\Root\subgroup"#<---------- without backslash at the end of the path or it will throw an error
Get-MCDeviceGroups -Token $token -parentPath "\\Root\subgroup"#<---------- without backslash at the end of the path or it will throw an error
Add-MCDeviceGroup -Token $token -Name "Groupname" -Icon None -Kind Regular -Path "\\Root\Subgroop\"#<---------- with backslash at the end or it will throw an error
Remove-MCDeviceGroup -Token $token -Name "Groupname" -Path "\\Root\"
Get-MCProfiles -Token $Token -nameContains "Lockdown"