Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit unifies the way the files are being deleted by introducing the `DeleteFiles` function. It refactors existing scripts that are deleting files to use the new function, to improve their documentation and increase their safety. Script changes: - 'Clear Software Reporter Tool logs': - Rename to: 'Clear Google's "Software Reporter Tool" logs' - 'Clear credentials in Windows Credential Manager': - Migrate code to PowerShell, removing the need to delete files. - Improve error messages and robustness of the implementation. - 'Clear Nvidia residual telemetry files': - Extract to two scripts for more granularity and better documentation: 1. 'Disable Nvidia telemetry components' 2. 'Disable Nvidia telemetry drivers' - Change the logic so instead of clearing directory contents and deleting drivers, it conducts a soft delete for reversibility to prioritize user safety. - 'Remove OneDrive residual files': - Improve documentation - 'Clear primary Windows telemetry file': - Rename to 'Clear diagnostics tracking logs'. - Add missing file paths seen on modern versions of Windows. - Add more documentation. - 'Clear Windows Update History (`WUAgent`) system logs': - Rename to 'Clear Windows update files'. - Add more documentation. - 'Clear Cryptographic Services diagnostic traces': - Rename to 'Clear "Cryptographic Services" diagnostic traces'. - Add more documentation. Other changes: - Improve `DeleteGlob`: - Add iteration callbacks for its reusability. - Improve its documentation. - Make recursion optional. - Improve sanity check (verification) logic for given glob when granting permissions. - Fix granting permissions using wrong variable to find out parent directory. - Improve `IterateGlob`: - Use `Get-Item` to get results. This fixes `DeleteDirectory` not being able to delete directory itself but just its contents. - Introduce and use `recurse` parameter to provide optional recursive search logic (to search in subdirectories) using `Get-ChildItem`. - Fix wrong PowerShell syntax for `$revert` variable value for `revertCode`: replace `true` with `$true`. - Order iterated paths based on their length to process the deepest item first. - Improve handling of missing files with correct/informative outputs when granting permissions. - Improve `SoftDeleteFiles`: - Introduce and use `recurse` parameter for explicitness. - Fix undefined `$backupFilePath` by replacing it with correct `$originalFilePath`. - Improve documentation. - Ensure consistent use of instructive language in code comments.
- Loading branch information