Disconnect Accounts Via Script/Registry/Directory Clearing

Nathaniel Alves 1 Reputation point
2021-03-08T18:53:03.853+00:00

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 10 Setup
Windows 10 Setup
Windows 10: A Microsoft operating system that runs on personal computers and tablets.Setup: The procedures involved in preparing a software program or application to operate within a computer or mobile device.
1,908 questions
Windows 10 Security
Windows 10 Security
Windows 10: A Microsoft operating system that runs on personal computers and tablets.Security: The precautions taken to guard against crime, attack, sabotage, espionage, or another threat.
2,758 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,381 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Ian Xue (Shanghai Wicresoft Co., Ltd.) 29,971 Reputation points Microsoft Vendor
    2021-03-09T09:38:00.693+00:00

    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.

    0 comments No comments