What I want to accomplish: When a user logs off a machine and is not on the domain, the contents of the recycling bin are deleted.
How this is currently done and works on domain: Domain GPO > User Config > Windows Settings > Scripts (Logon/Logoff) > Logoff > The below batch file is in the logoff script folder on the domain controller and this works flawlessly when it is linked to the User OU.
Batch file: PowerShell.exe -NoProfile -Command Clear-RecycleBin -Confirm:$false
My thoughts The above batch file runs fine as user so can run locally. I thought about putting the batch file to a local file for all users i.e C:\ - but how do achieved getting that to run on log off via Domain GPO please?
I am aware I could investigate using GPO to run local task scheduler at a specified time, wondering if I would have the same problem if machine was not connected to the Domain, and we have irregular login/out times for many staff so I want it to trigger on a guaranteed event i.e Logoff - or even Login.
Many thanks in advance for any guidance.