Remove accounts from device using script (idealy)

Solved
TM

Hello,

I have a multiuser devices where for example:
Morning shift at a factory pickup a device and logs-into MS apps.
Later on he hands over device to afternoon shift, but forgot to log-off his MS account.
MS apps can not get missused thanks to Intune's MAM policy that required PIN code while opening the apps.

BUT!

I need to log-out the other user, so I created a script in lockdown that users can click and it runs this:
clearappcache com.microsoft.office.outlook
clearappcache com.microsoft.teams

So it clears cache, but since the account is still stored in the phone itself the afternoon shift can still log-onto his account.

I couldnt find any script that would get rid of the account from device. So how do I do this?
"I need users to be able to remove account within Kiosk mode"

2 years ago
Android Scripting
ANSWERS
MD
Matt Dermody Diamond Contributor
2 years ago
MD
Matt Dermody Diamond Contributor
2 years ago

This recent request also sounds very much like what you're dealing with:

https://discussions.soti.net/thread/force-auto-logout-of-ms-applications

I generally have not had success in enabling the usage of MS apps like Teams and Outlook on shared devices and have personally recommended named devices per user in these scenarios in the past. That might change once the Shared Device Mode feature becomes available. 

TM
Tomas Malich
2 years ago

Hello Matt,

Thank you for the quick reply. Indeed, both of these things look exactly like solutions to my problem.
I will wait till its pushed to production.

Thank you :)

AW
Adam Williams
2 years ago

Hi Tomas,

While youre waiting for those features, you could use "__wipeaccount" to your script. Not sure which accounts are created on the device when your users sign into applications but they could be along the lines of e.g. 

__wipeaccount -t "com.microsoft.workaccount"

__wipeaccount -t "com.microsoft.office"

__wipeaccount -t "com.microsoft.sharepoint"

__wipeaccount -t "com.microsoft.skydrive"

You could sign into all of your applications and then Settings->Accounts.

These are what you are looking to delete for the shared user, these accounts retain the previous user info.

I also use wipeapplication "com.microsoft.office.word" instead of clearappcache. Though not nessessarily suggesting you alter yours.

Solution
TM
Tomas Malich
2 years ago

Hi Adam,

What a legend! This is exactly what I needed.

The last thing Iam trying to do is to add a simple: IF where it would ask user to confirm before running it if he is sure, but I can not get it to work (propably syntax issue).

Can you please confirm how the syntax should be?

showmessagebox "Are you sure you want to log-out of MS apps?" NO_TIMER 4 OK
if %ShowMessageBoxReturn% == IDOK

clearappcache com.microsoft.office.outlook
clearappcache com.microsoft.teams
wipeapplication com.microsoft.office.outlook
wipeapplication com.microsoft.teams
__wipeaccount -t "com.microsoft.workaccount"
__wipeaccount -t "com.microsoft.office"
__wipeaccount -t "com.microsoft.sharepoint"
__wipeaccount -t "com.microsoft.skydrive"

if %ShowMessageBoxReturn% == IDCANCEL showmessagebox "You canceled the sign out" NO_TIMER 1

AW
Adam Williams
2 years ago

Hi Tomas

Unfortunately the devices I have tested with dont support IF (A log is created to reflect this) so I cannot comment on the syntax for this I am afraid.

However, have you considered Matts suggestion of setting up shared device within SOTI? Here when you log out you can toggle the shared device to clear shared application data. 

M
MNMOD@SOTI
2 years ago

Hi Tomas,

Thank you for posting on SOTI Pulse!

Thank you for marking Adam's post as solution. If you require any more assistance, please feel free to let us know.

Have you heard? SOTI SYNC is back – this time in Munich, Germany! Save the date – 26th-28th September 2023.

Meet the experts in enterprise mobility management, mingle with peers, join our training sessions, and have fun! #SOTISYNC2023

Kind regards,

Technical Support Specialist | SOTI | +1 905.624.9828 | SOTI.net l Discussion Forum | Log a Case Online l Facebook l LinkedIn l Twitter