Assuming a profile (P1) was created on day 1 and then left open for 24 hours (and kept open), if an additional profile (P2) is created by the execute of the script on day 2, the script will error as it tries to cleanup P1. The script does not seem to distinguish between >1 day old profiles that are still in use by active chrome windows and those that are not,
To reproduce:
- Go through the process of creating a "TempPlexProfile*" chrome profile by running the script (verify a profile is created in local appdata). Make sure that the newly open chrome windows remains open.
- Modify the script to set cleanupDate to the current date.
- Run the script and view the output.