I currently have a simple batch file that deletes unnecessary cached data at log out for multiple workstations set as a GPO. I am trying to amend it to report back to me in one text doc every time this runs on the various workstations with the date as the name of the text doc and the name of the workstation and the user it was run for as the contents, (examples below).
Current Script Example:
Echo off
Del /f /s /q "C:\User\%username%\AppData\Local\Microsoft\OneNote\16.0\Backup"
Del /f /s /q "C:\User\%username%\AppData\Local\Microsoft\OneNote\16.0\Cache"
Del /f /s /q "C:\Users\%username%\AppData\Roaming\Microsoft\OneNote\16.0"
Requested Output Example:
File name: 20220815.txt
contents:
UserName | Workstation 1 | Time
UserName | Workstation 2 | Time
Etc.
File name: 20220816.txt
contents:
UserName | Workstation 1 | Time
UserName | Workstation 2 | Time
Etc.
Any help would be greatly appreciated.