question

NathanielAlves-9816 avatar image
0 Votes"
NathanielAlves-9816 asked ·

Disconnect Accounts Via Script/Registry/Directory Clearing

Hello,

I am running into an issue where users on kiosk devices are connecting their work/school accounts under emails and accounts. We have a GPO set to block the accounts and that works when they try to login under "Access work or school" but if they go to "Email & Accounts" and select "Add a work or school account" it allows them to connect it. We have a SSO badge tap software that I am using to invoke a script on badge out. I found that clearing all files and sub-folders from c:\Users\%USERNAME%\AppData\Local\Packages\Microsoft.AAD.BrokerPlugin_cw5n1h2txyewy and then rebooting clears and disconnects the account at the next time the device auto-logs in.

However, I am looking for a way to disconnect the accounts in the moments via script whether it be registry changes or other directories I am missing.

Thoughts?

Nate

windows-server-powershellwindows-10-setupwindows-10-security
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

IanXue-MSFT avatar image
0 Votes"
IanXue-MSFT answered ·

Hi,

To delete files you can use the Remove-Item cmdlet

 $path = "c:\Users\$env:username\AppData\Local\Packages\Microsoft.AAD.BrokerPlugin_cw5n1h2txyewy"
 Get-ChildItem -Path $path | Remove-Item -Recurse

Best Regards,
Ian Xue
============================================
If the Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.