Community - SOTI MobiControl

Community - SOTI MobiControl

There's a new home for Articles. Find Articles on Our Product Support Page.

SOTI MobiControl Discussions


  • 0 votes 2 answers

    Powershell access issue when upgrading MobiControl from 2024.1.0 to 2025.0.0

    Hello there, I'm trying to upgrade MobiControl from 2024.1.0 to 2025.0.0 and experiencing an issue at the end of the installer, at this step: "Upgrading Web Console: Finalizing" Error encountered: [2024-12-16 15:14:30.706] INFO [Install] (.NET TP Worker): Finalizing Installation[2024-12-16 15:14:30.811] INFO [BtnNext_ClickAsync] (1): Load Install failed window[2024-12-16 15:14:30.815] ERROR [BtnNext_ClickAsync] (1): Installation failed while installing - Web Console[2024-12-16 15:14:30.822] ERROR [BtnNext_ClickAsync] (1):  ****************************************************************************************************************************************************************************************************************************************************** Exception: Error occurred while executing: powershell. Exception message: An error occurred trying to start process 'powershell' with working directory 'C:\Users\xxxxxxx\AppData\Local\Temp\{BBD91520-FB19-4034-8475-60D59DBFDD5D}'. Acces refused. * Has a kind soul experienced this error and found a solution that could be shared with me please? Thanks! Best regards,

    SOTI MobiControl
    11 months ago
  • 0 votes 1 answer

    PowerShell - Uploading APK files to API Packages/v2

    Hello, I have some trouble uploading an APK to the API via packages/v2. $Header = @{}$Header["Authorization"] = "Bearer " + $script:Token$Header["Accept"] = "application/json"$boundary = "mobicontrol_boundary" $BinaryString = [IO.File]::ReadAllBytes($PathToAPK)$LF = "`r`n"$body = "--${boundary}${LF}" $body += "Content-Type: application/vnd.soti.mobicontrol.packagearchive.metadata+json${LF}${LF}"$body += '{    "PackageName":"AutoAPP TestPackage", "PackageVersion":"1.0", "PackagePlatform":"Android",    "PackageFiles": [{ "FileName":"Testfile.apk", "FileSourceType":"Binary" } ],     "PackagePrompt": { "ShowPromptBeforeInstall": false, "PromptMessage":"Install package PackageName now?", "PromptMessageTimeout":10 }}'$body += $LF$body += "--${boundary}${LF}"$body += "Content-Type: application/octet-stream${LF}"$body += "Content-Type-Encoding: Binary${LF}"$body += 'Content-Disposition: attachment; filename="Testfile.apk"' + $LF$body += $LF$body += $BinaryString$body += "${LF}${LF}--${boundary}--${LF}" $response = Invoke-WebRequest -Uri ("https://" + $script:MCFQDN + "/mobicontrol/api/packages/v2") -ContentType "multipart/related; boundary=$boundary" -Method POST -Headers $Header -Body $Body -Verbose I get a success on the upload and after that, on the device, i get I/O error and when I download the package from MobiControl and unpack it, the SettingsManager apk file is 20mb instead of the original 5mb. But if I write the $binarystring back to a file with set-content, I get a 5mb file. An example write-out of $body where I have limited the binarystring output to 100 for readability: --mobicontrol_boundaryContent-Type: application/vnd.soti.mobicontrol.packagearchive.metadata+json {        "PackageName":"AutoApp TestPackage", "PackageVersion":"1.0", "PackagePlatform":"Android",         "PackageFiles": [{ "FileName":"Testfile.apk", "FileSourceType":"Binary" } ],        "PackagePrompt": { "ShowPromptBeforeInstall": false, "PromptMessage":"Install package PackageName now?", "PromptMessageTimeout":10 }    } --mobicontrol_boundaryContent-Type: application/octet-streamContent-Type-Encoding: BinaryContent-Disposition: attachment; filename="Testfile.apk" 80 75 3 4 0 0 0 0 8 0 33 8 33 2 62 29 233 132 51 0 0 0 56 0 0 0 57 0 0 0 77 69 84 65 45 73 78 70 47 99 111 109 47 97 110 100 114 111 105 100 47 98 117 105 108 100 47 103 114 97 100 108 101 47 97 112 112 45 109 101 116 97 100 97 116 97 46 112 114 111 112 101 114 116 105 101 115 75 44 40 240 77 45 73 76 73 44 73 12 75 45 --mobicontrol_boundary-- So, do anyone have any idea as to why the apk file when received by MobiControl gets bigger/corrupt? Thanks in advance

    SOTI MobiControl
    a year ago
  • 0 votes 7 answers

    Creating Profiles via API through PowerShell

    Hello! I have been trying to create a profile through PowerShell and the MobiControl API. The end goal is to have a package assigned to it as well. Have been trying the following: Using Content-Type text/xml $xmltest = '<?xml version="1.0" encoding="UTF-8"?><Profile>    <Name>APITest_NewProfile</Name>    <Description>Test</Description>    <DeviceFamily>AndroidPlus</DeviceFamily>    <DeviceFamilyQualification>AndroidWork</DeviceFamilyQualification></Profile>' $response = Invoke-RestMethod -Uri "https://$MCFQDN/mobicontrol/api/profiles" -ContentType "text/xml" -Method POST -Headers $Header -Body $xmltest -Verbose I have also tried with a hashtable too, but either way I get the same error:"profileRequest: Error parsing value Contract validation failed" I have looked at the api list, and it appears to me that these is the minimal required fields when not attaching a package. Thanks in advance Mikael

    Android
    a year ago
  • 0 votes 2 answers

    Call a PowerShell script on Windows Modern devices

    I would like to create a package for Windows Modern devices that will send some files over and then run a PowerShell .ps1 script. Is this possible?   Is this the proper way to call a batch file using a script delivered via a package? c:\basys\Retread.Mfg.Client.Windows_1.37.4.0_Test\ActiveSetupConfiguration.bat It does not run on the target device  

    Windows
    2 years ago
  • 0 votes 6 answers

    Possible to execute self-elevated Powershell scripts through MobiControl?

    I have some scripts I want to send out to a department of laptops to help configure a new VPN we'll be using. The first script enables Split Tunneling and the other adds and app trigger for mstsc.exe. Because of how busy the members of this department often are, I'd like to leverage MC to send these scripts to each laptop for me. However, even after adding a snippet to the beginning that should self-elevate the scripts if (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { $arguments = "& '" +$myinvocation.mycommand.definition + "'" Start-Process powershell -Verb runAs -ArgumentList $arguments Break } however, the logs always result in the error that the new VPN connection name cannot be found. Digging into the error, it seems most likely that this is due to the script not actually running as elevated. Has anyone successfully sent and executed a self-elevating Powershell script through Mobicontrol?

    Windows
    2 years ago
  • 0 votes 2 answers

    Modifying a Custom Attribute on an device by API & PS Solved Locked

    I am trying to make an API call to update one device in using the reference ID. I am able to fetch token but having issue when using PUT to update the device. Here is what i tried so far: ### Call API #Module and Configurations API Import-Module -Name "F:\SOTI_API\Mod-MobiControl.psm1" Set-TrustAllCertsPolicy $Token = Get-MCToken $MCFQDN = Get-MCFQDN #Core script $headers = @{} $headers["Authorization"] = "Bearer " + $Token $deviceId = "9c5c8e786faa050100171845214D2417" $AttributeValue = @{} $AttributeValue["customAttributeValue"] = "123" $body = $AttributeValue | ConvertTo-Json #PUT customAttributes Projet $result = Invoke-restmethod -Uri "https://$MCFQDN/mobicontrol/api/devices/$deviceId/customAttributes/Projet" -ContentType "application/json" -Method PUT -Headers $headers -body $body When trying to execute the above, getting below error:Invoke-restmethod : { "$type": "ErrorDetails", "ErrorCode": 0, "Message": "Échec de validation du contrat", "Data": [ "customAttributeValue: Error parsing value" ], "HelpLink": null }Au caractère Ligne:22 : 15+ $result = Invoke-restmethod -Uri "https://$MCFQDN/mobicontrol/api/devices/$d ... Any help is greatly appreciated.  

    SOTI MobiControl
    4 years ago
  • 0 votes 2 answers

    How to use API to create custom Attributes on a group level Solved Locked

    Hello, I'm trying to edit my existing PowerShell script that created the device group but I'm a bit confused on the formatting needed for the custom attribute. For device group creation, I looked at the forums and copied the example of using: $devicegroup = @{} $devicegroup["Name"] = $Name $devicegroup["Path"] = $Path + $Name $devicegroup["Icon"] = "Red" $devicegroup["Kind"] = "Regular" I tried changing it around to try to mimic the json on the API page but not luck, even tried doing: $customAttribute = '{ "Attributes" : [ { "AttributeName":"StoreNumber", "AttributeValue":"1234"}]}' but that is also failing on me. Anyone have any suggestions?

    SOTI MobiControl
    4 years ago
  • 0 votes 3 answers

    Powershell script execution on Windows Modern Device Solved

    I created a simple package that includes a simple powershell script. I set the property on the file (in the package) as auto execute. The script is installed ok, but the script is simply "opened" with notepad. I even tried changing the app associate with the script file type from notepad to powershell but that made no difference. Any suggestions? A.

    Windows
    4 years ago
  • 0 votes 5 answers

    Powershell API POST /devicegroups/{path}/members

    I have a script i am trying to get working, which is designed to move a specific device ID to a specific virtual group. I have several other API methods working properly in power-shell, but the POST /devicegroups/{path}/members is not wanting to play nice. Below is my redacted code:    param (         [parameter(mandatory = $true)]         [string]$apiToken,          [parameter(mandatory = $true)]         [string]$DeviceID,          [switch]$disable     )     $Header = @{         "Content-Type"  = "text/json"         "Authorization" = "Bearer $($apitoken)"     }        $DeviceIDs = @("$($DeviceID)")       if ($disable) {         $groupPath = "referenceId:9959e8d1-4878-41e4-ba2d-4765b45f48d3"         $body = @{             "GroupPath" = $groupath             "deviceIds" = $DeviceID         }             $groupPath = [System.Web.HttpUtility]::UrlEncode($groupPath)         $workingURL = "https://###REMOVED###/MobiControl/api/devicegroups/$($grouppath)/members"                  Write-verbose $body         write-verbose $DeviceID                $result = Invoke-restmethod -Uri $workingURL -Method POST -Headers $Header -Body $body                  $groupPath = "referenceId:23429449-fa78-44b6-9896-65499fe7b27d"         $body = @{             "GroupPath" = $groupath             "deviceIds" = $DeviceID         }                  $groupPath = [System.Web.HttpUtility]::UrlEncode($groupPath)                 $workingURL = "https://###REMOVED###/MobiControl/api/devicegroups/$($grouppath)/members"                  Write-verbose $body         write-verbose $DeviceID             $result = Invoke-restmethod -Uri $workingURL -Method POST -Headers $Header -Body $body         return $result               }     else {         $groupPath = "referenceId:9959e8d1-4878-41e4-ba2d-4765b45f48d3"         $body = @{             "GroupPath" = $groupPath             "deviceIds" = $DeviceID         }                 $groupPath = [System.Web.HttpUtility]::UrlEncode($groupPath)         $workingURL = "https://###REMOVED###/MobiControl/api/devicegroups/$($grouppath)/members"         Write-output $body         write-verbose $DeviceID                  $result = Invoke-restmethod -Uri $workingURL -Method POST -Headers $Header -Body $body         return $result      }               }     After running it i receive the following api response:   Invoke-restmethod : { "$type": "ErrorDetails", "ErrorCode": 0, "Message": "Contract validation failed", "Data": [ "deviceIds: Error parsing value" ], "HelpLink": null}   No matter how i pass the deviceids value it always returns a parse error.   I have tried the following   the device ID in an array the device ID in quotes device ID in square brackets those three converted to json     The only time i have gotten it to work was on the API documentation page on my server

    SOTI MobiControl
    5 years ago
  • 5 votes 1 answer

    MobiControl PowerShell cmdlets Solved Locked

    Good morning I started to check out the API of MobiControl and was struggling and didn't understand the authentication. But with help from this community I got some codesnippes and it's working now.  I then started to look into simple requests also with help from this forum and the api documentation and created a few functions for our company.  I'd like contribute and share those PowerShell cmdlets with you and maybe make some peoples lifes easier. I tested the function in our environment and like to get some feedback if it also works for you and also if you have any suggestions for code improvments. https://github.com/noaboa97/MobiControl-cmdlets Best Noah

    SOTI MobiControl
    5 years ago
  • 0 votes 3 answers

    Device Renaming with PowerShell API

    I have been reading through these forums and finding a lot of help regarding API request. So far I'm able to request my API token via PS and use it for device management!   I'm fairly new to using API calls in PS and I can't seem to get around renaming a device.  I' almost certain the issue is with how I'm using the -Body portion of the PS code.  Here is what I have so far: #ALLOWS USER INPUT OF DEVICE NAME [void][Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic') $title = 'Device Rename'$msg = 'Enter New Device Name:'$Input = [Microsoft.VisualBasic.Interaction]::InputBox($msg, $title) $Header2 = @{}$Header2["Authorization"] = "Bearer " + $Token try{$response2 = Invoke-restmethod -ContentType "application/json" -Uri https://$MCFQDN/mobicontrol/api/devices/$DevID/actions -Method POST -Headers $Header2 -Body {\"Action\": \"Rename\",\"Name\" : \"$Input\"} }catch{$($_.Exception.Message)} As stated, I think the -Body section is where I'm failing, not sure how to convert the curl request to a body in PowerShell. Greatly appreciate any help!

    Windows
    5 years ago
  • 0 votes 1 answer

    Create Geofences with Powerhshell

    Hey Guys, I try to Automating the Onboarding of my Customers.  I want To Automate the creation of a Geofence.  But i get the Following Error from Powershell:  Invoke-restmethod : { "$type": "ErrorDetails", "ErrorCode": 0, "Message": "Contract validation failed", "Data": [ "geofenceAddRequest.$type: Error parsing value" ], "HelpLink": null}In Zeile:2 Zeichen:7+ Invoke-restmethod -Uri https://$MCFQDN/Mobicontrol/api/geofence ...+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand I hope you can help Me.  Thank You Greeting  Daniel  __________________________________________________________________________________________________ Code:  $json=Get-Content "C:\Users\dobbertind\Documents\Exchange Online\Powershell Scripte\EMM\GeofenceVorlagenew.json" Invoke-restmethod -Uri https://$MCFQDN/Mobicontrol/api/geofences -ContentType "application/json" -Method Post -Body $json -Headers $Header2 Thats The Conent of the File:  { "$type": "Geofence", "Name": "test", "Vertices": [ { "$type": "LatLong", "Latitude": 51.48232758114372, "Longitude": 7.321427263198861 }, { "$type": "LatLong", "Latitude": 51.480049150806735, "Longitude": 7.32170621293641 }, { "$type": "LatLong", "Latitude": 51.480690597252305, "Longitude": 7.3271779193267905 }, { "$type": "LatLong", "Latitude": 51.48279528003457, "Longitude": 7.326019205032357 }, { "$type": "LatLong", "Latitude": 51.48249354910483, "Longitude": 7.321678533438556 }, { "$type": "LatLong", "Latitude": 51.48028194457554, "Longitude": 7.322204246405475 }, { "$type": "LatLong", "Latitude": 51.48076970947561, "Longitude": 7.327000036124103 }, { "$type": "LatLong", "Latitude": 51.48260045174229, "Longitude": 7.325680389288776 }, { "$type": "LatLong", "Latitude": 51.48237996477796, "Longitude": 7.322032585028522 }, { "$type": "LatLong", "Latitude": 51.48051580511012, "Longitude": 7.322622671011798 }, { "$type": "LatLong", "Latitude": 51.48091002443958, "Longitude": 7.3265816115177795 }, { "$type": "LatLong", "Latitude": 51.48245346055118, "Longitude": 7.325530185583942 }, { "$type": "LatLong", "Latitude": 51.48215947674761, "Longitude": 7.322279348257892 }, { "$type": "LatLong", "Latitude": 51.48060266728896, "Longitude": 7.322807324514047 }, { "$type": "LatLong", "Latitude": 51.48103697570167, "Longitude": 7.326304925069467 }, { "$type": "LatLong", "Latitude": 51.48234655756915, "Longitude": 7.3253607874962245 }, { "$type": "LatLong", "Latitude": 51.48203921009992, "Longitude": 7.322603476628915 }, { "$type": "LatLong", "Latitude": 51.48080311783952, "Longitude": 7.323107731923715 }, { "$type": "LatLong", "Latitude": 51.48110379201345, "Longitude": 7.326015246495858 }, { "$type": "LatLong", "Latitude": 51.48222629141484, "Longitude": 7.324996007070199 }, { "$type": "LatLong", "Latitude": 51.48193230614682, "Longitude": 7.322946799382821 }, { "$type": "LatLong", "Latitude": 51.48099688586761, "Longitude": 7.323279393300668 }, { "$type": "LatLong", "Latitude": 51.481177289843345, "Longitude": 7.325607550725595 }, { "$type": "LatLong", "Latitude": 51.48205257307644, "Longitude": 7.324759972676889 }, { "$type": "LatLong", "Latitude": 51.48187217256309, "Longitude": 7.32322574912037 }, { "$type": "LatLong", "Latitude": 51.481163926610364, "Longitude": 7.323504698857919 }, { "$type": "LatLong", "Latitude": 51.48124410594958, "Longitude": 7.325103295430795 }, { "$type": "LatLong", "Latitude": 51.481892217099805, "Longitude": 7.324631226644174 }, { "$type": "LatLong", "Latitude": 51.48174522362591, "Longitude": 7.323461783513681 }, { "$type": "LatLong", "Latitude": 51.48123742434335, "Longitude": 7.32371927557911 }, { "$type": "LatLong", "Latitude": 51.48132428514781, "Longitude": 7.324749243840829 }, { "$type": "LatLong", "Latitude": 51.48174522362591, "Longitude": 7.324373734578744 }, { "$type": "LatLong", "Latitude": 51.48162495588576, "Longitude": 7.323611987218515 }, { "$type": "LatLong", "Latitude": 51.4813510115159, "Longitude": 7.323858750447885 }, { "$type": "LatLong", "Latitude": 51.48145028185666, "Longitude": 7.324405921086923 }, { "$type": "LatLong", "Latitude": 51.48157723161486, "Longitude": 7.323837292775766 }, { "$type": "LatLong", "Latitude": 51.482477624526545, "Longitude": 7.321763646515662 }, { "$type": "LatLong", "Latitude": 51.48072037589533, "Longitude": 7.326967132004554 }, { "$type": "LatLong", "Latitude": 51.48272483658168, "Longitude": 7.325958621414954 }, { "$type": "LatLong", "Latitude": 51.48012570227965, "Longitude": 7.321795833023841 }, { "$type": "LatLong", "Latitude": 51.482478472563315, "Longitude": 7.324003249747011 }, { "$type": "LatLong", "Latitude": 51.481046267281435, "Longitude": 7.326575013957322 }, { "$type": "LatLong", "Latitude": 51.48152734244336, "Longitude": 7.322047445140183 }, { "$type": "LatLong", "Latitude": 51.48265651281907, "Longitude": 7.32186505492717 }, { "$type": "LatLong", "Latitude": 51.482589698782164, "Longitude": 7.321285697779953 }, { "$type": "LatLong", "Latitude": 51.48232758114372, "Longitude": 7.321427263198861 } ]}

    SOTI MobiControl
    6 years ago
  • 0 votes 13 answers

    API Curl to Powershell Device group movement Solved

    I made a few changes, but now getting a (401) Unauthorized error, not sure what else I'm missing.The Curl API command for moving device groups:curl -X PUT --header "Content-Type: application/json" --header "Accept: application/json" --header "Authorization: Bearer Very long token" -d "\"\\\\RootFolder\\New folder\"" "https://SOTIServer.com:443/MobiControl/api/devicegroups/%255C%255CRootfolder%255COld%2520folder%255CSourceFolder/path" The Powershell call that I have so far, that doesn't work: $folderX="SourceFolder" function MoveDir ([string]$Name, [string]$Token){ $Path = "%255C%255CRootfolder%255COld%2520folder%255C" + $folderX$body = @{}$body = "`"\\RootFolder\New Folder`""$body = $body | ConvertTo-Json $Header2 = @{}$Header2["Authorization"] = "Bearer " + $Token try{$response2 = Invoke-restmethod -Uri https://$MCFQDN/mobicontrol/api/devicegroups/$Path/path -ContentType "application/json" -Method PUT -Body $body -Headers $Header2 }catch{$($_.Exception.Message)}}

    SOTI MobiControl
    7 years ago
  • 1 votes 4 answers

    Using powershell to make API calls Solved

    Looking to create device groups (a few hundred) from a list in a text file. I'm most familiar with powershell, but I've not worked with API's or security tokens before. Does anyone have a template or sample scripts that they would be willing to share?

    SOTI MobiControl
    7 years ago
  • 0 votes 5 answers

    Powershell script in package; Windows Desktop

    Device: Windows Desktop Goal: create directory file list (text file) POST copy routine Summary: - Package contains N number of files to be copied to a specific folder - Prescript creates file list BEFORE copy (via Powershell) - Postscript creates file list AFTER copy (via Powershell) Syntax: start powershell.exe c:\temp\DirPost.ps1 Powershell scripts are located in c:\temp directory I'm not able to get Powershell to run.  I can call it via the script window without issue but it fails to run via the package postscript.  I've considered using "shellexecute" but SOTI doesn't provide a list of "VERBS". ---- extract from SOTI Help file ---- shellexecute filepath -verb [-wseconds] Where -verb is the action you want the shell to execute -w tells the command to wait for the specified length of time (in seconds) before executing ---------------------------------------

    Windows
    7 years ago

Top 3 Contributors of The Week

View All

Earn Contributor Badge

More info
  • Diamond
    Diamond New !

    Top-tier experts who are delivering outstanding content. Should have more than 7000 points.

  • Platinum

    Experts who are consistent with great content. Should have more than 1000 points

  • Gold

    Highly experienced members with valuable inputs. Should have more than 700 points

  • Silver

    Beginners taking the initiative. Should have more than 500 points