Identify and delete old logon scripts
Delete logon scripts from deactivated users
With this script we delete logon scripts (x.bat) from deactivated users in the Active Directory.
The script first reads in all logon scripts and filters them using 2 log files for deactivated users and activated users.
The log file of the deactivated users is read in and the powershell script only deletes the logon scripts of the inactive users.
I currently have 5 logon scripts and 5 users.
3 out of 5 users are deactivated.
Run the script and 3 logon scripts have been deleted.