Hi,
I am keen to hear if anyone knows how it is possible, via a script, to initiate the connection of a device to an SSID that already has a profile created on the device, but is different from the one the device is currently connected to.
Hi,
I am keen to hear if anyone knows how it is possible, via a script, to initiate the connection of a device to an SSID that already has a profile created on the device, but is different from the one the device is currently connected to.
No, it's not.
We had similar requests to Soti support (our TAM) in the past but the only way was to delete all other known ssid's (bad idea) or if you are on Mobicontrol 2024+ to redeploy the wifi profile with the "Set as Active Network" enabled which force (re-)connects all assigned devices once to this SSID (also not a good idea).
Hi, its possible by JavaScript. The documentation is here:
https://www.soti.net/mc/help/javascriptapi/en/mobicontrol.wifi.html
Hi Thomas,
more precisely, how exactly would you do it? Is JavaScript integrable into a Signal policy?

Unfortunately, a Java script cannot be initiated by the device through a Signal policy.
It's not as you can just deploy again the already known SSID with the relevant settings and because of deploying that it can be that it connects to it but there's no "connect to" or so available in JS just pointing to a SSID to connect to like by Name or so without providing any additional connection information which are already stored on the device.
as Remy wrote "to initiate the connection of a device to an SSID that already has a profile created on the device, but is different from the one the device is currently connected to"
i assumed that there is more than 1 SSIDs configured and available in "Saved Networks"
With this small JS script, i am able to switch to any configured SSID on my device:
var ProdAP = mobicontrol.wifi.listAccessPoints().find(ap => ap.ssid == 'SSID-i-want-to-connect');
mobicontrol.wifi.enable(ProdAP);
For the WifiError: Location services are off, I did raise a ticket in May 2024, as you will see the same error if you use mobicontrol.wifi.uninstall().
I fail to understand the relationship between Location services and these script commands.
Also, and that is another ticket: It is not possible to run Locations services on with MobiControl.
Could you please tell me which ecosystems you encountered this issue with? Honeywell, Zebra, etc.
It worked! However, I’m not sure if this setting can be automated without direct interaction with the device...
Are there any opinions/solutions on this?

this should be done by a FeatureControl policy -> Location Accuracy -> you need "Battery Saving" at least (this way its working on our devices)
thats a bit strange, on my devices (AE Work Managed, different OEMs and OS versions) this works without issue. If the profile was installed without error message you should contact SOTI's Support Team, maybe also check the logs in the console and also the agent activity log
I notice that the issue has already been reported, although for a different use case...https://discussions.soti.net/discussions/cannot-remove-a-wifi-network-with-javascript-mobicontrol-wifi-uninstall
For moderators! Could someone provide a definitive resolution to clearly outline the situation we are facing, ensuring all interested parties are informed?
|
Google Location Accuracy
|
|
|
|
That's interesting as i thought this would just enable them (allow them to connect to automatically)but not a force connect to them and our question to support even stated nothing in that direction. I'll give that a try as well.
Rafael, I understand you have Honeywell devices in your fleet. Could you confirm whether the location functionality is working or not? Thanks!
No sorry, the sorting here is horrible. I answered to the response from Thomas G as i wonder that his script will do something different than expected.
But i can confirm, even from my end unexpected, the script from Thomas G. above works quite well at least on our devices (we don't have Honeywell devices).
I can also confirm the script works well on my end. I've tested it on Zebra A13 devices so far.
Hi Matt,
If possible, please try it on a Honeywell device as well. I’m interested in the issue related to the location settings.
Hi, we also use HSM devices. But we do not configure 'Location Accuracy' with Honeywell's Enterprise Provisioner (or any other OEM tools), only by SOTI's FC Policy.
Hi Thomas,
Thank you for the feedback!
Could I kindly ask you to specify which device families (model/build) you are referring to?
I just tested it on two CT40XP with Android 9 & 12, works for both without issue. If i set "High Accuracy", access to location setting is blocked by admin and i see that Google apps like PlayStore and YouTube are using location service. If i set "Allow user to configure" access to location is possible for the device user and you can switch it on / off. Also the script is working.
So, the automation functions until the moment the device user manually intervenes to change the setting in question?
Hi Remy,
I don't have Honeywel device with me, but I did use a JS script earlier with Samsung and Zebra devices well to overwrite WiFi SSID or connect a new SSID, I'm not sure did you use a similar JS library for your test earlier, but here is my JS that I've created about 2 years ago. I've used to get the information from device side for the WiFi credential but you can directly use it on your script as well instead of reading them from JSON
If you need any help you can let me know.
It's available for Agent version of 15.4.0+
First create a JSON file that consist of SSID and password of the WiFi, and save this file on the device path; for this example it is saved at /sdcard/download/readzafer.json location (name of this json file is "readzafer.json" for this case). The content of the JSON file may be as follows:
{
"password": "wifipassword_here",
"ssid": "SSIDname_here"
}
And send below JS Script to device:
var wifiConfigJSON = new mobicontrol.io.File('/sdcard/download/readzafer.json');
var jsonString = wifiConfigJSON.readText();
var wifiConfigString = JSON.parse(jsonString, mobicontrol.json.revive);
mobicontrol.message.createInfoDialog("SSID:" + wifiConfigString.ssid).show();
mobicontrol.message.createInfoDialog("password:" + wifiConfigString.password).show();
var wifiConfig = mobicontrol.wifi.createWifiConfiguration(wifiConfigString.ssid).withWpaSecurity(wifiConfigString.password);
mobicontrol.wifi.install(wifiConfig);
var accessPoint = mobicontrol.wifi.listAccessPoints().find(ap => ap.ssid == wifiConfigString.ssid);
mobicontrol.wifi.enable(accessPoint)
I hope it helps
Zafer
Hi Remy,
Thanks for posting on SOTI Pulse. If this post did not assist you in resolving the issue completely and you have additional questions, please do not hesitate to reach out or you can contact SOTI Support (support@soti.net) to open a new case and one of our support engineer will be there to assist you.
Kind Regards,
Technical Support | SOTI Inc. |1.905.624.9828 | support@soti.net | www.soti.net |