From 7634c7136c49ca09348a9d58cf24fc2c8dfc58b1 Mon Sep 17 00:00:00 2001 From: Kyle Date: Mon, 5 May 2025 01:43:24 +0000 Subject: [PATCH] Update README.md --- README.md | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 58 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 17fdff5..7e46cf8 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,60 @@ # Add-RecurseSecurityGroup -A powershell script which adds a security group to a folder and all subfiles and folders. - -To be used when subfolders have inheritance disabled but you still need to apply a security group to all. \ No newline at end of file +A powershell script which adds a security group to a folder and all subfiles and folders. + +To be used when subfolders have inheritance disabled but you still need to apply a security group to all. + + +The script will: + +- Process all files and folders recursively +- Apply the specified permissions with the security group +- Handle objects with disabled inheritance +- Log all actions to both console (with colors) and log file + +Script Features: +- Color-coded console output (Green for INFO, Yellow for WARNING, Red for ERROR) +- Comprehensive logging to C:\Logs\ApplySecurityGroup with DD-MM-YYYY date format +- Parameter validation for folder existence, group validity, and permission types +- Progress tracking and summary reporting +- Error handling for individual items (won't stop on single failure) +- The script will continue processing even if some items fail, and provide a summary of successes and failures at the end. + +Example Console Output: + +``` +05-05-2025 14:30:15 INFO: Starting security group application process +05-05-2025 14:30:15 INFO: Target Folder: C:\Shared\BiscuitTin +05-05-2025 14:30:15 INFO: Security Group: KITCHEN\FS - RO - Shares - Biscuit Tin +05-05-2025 14:30:15 INFO: Permission: Read +05-05-2025 14:30:17 INFO: Found 12 folders and 47 files to process +05-05-2025 14:30:17 INFO: Applied permissions to folder: C:\Shared\BiscuitTin\Recipes +05-05-2025 14:30:17 INFO: Applied permissions to folder: C:\Shared\BiscuitTin\Financial +05-05-2025 14:30:18 WARNING: Failed to apply permissions to folder 'C:\Shared\BiscuitTin\Secure': Access is denied +05-05-2025 14:30:18 INFO: Applied permissions to file: C:\Shared\BiscuitTin\recipe_chocolate_chip.docx +05-05-2025 14:30:18 INFO: Applied permissions to file: C:\Shared\BiscuitTin\recipe_ginger_snap.pdf +05-05-2025 14:30:19 ERROR: Failed to apply permissions to file 'C:\Shared\BiscuitTin\Financial\secret_recipe.xlsx': The process cannot access the file because it is being used by another process. +05-05-2025 14:30:22 INFO: Processing complete. Successfully processed 56 items, 3 failures. +05-05-2025 14:30:22 INFO: Total items: 59 +05-05-2025 14:30:22 INFO: Log file created at: C:\Logs\ApplySecurityGroup\ApplySecurityGroup_05-05-2025.log +05-05-2025 14:30:22 WARNING: Warning: Some items failed to process. Check the log for details. +``` + +Example Log File Output: +``` +05-05-2025 14:30:15 INFO: Starting security group application process +05-05-2025 14:30:15 INFO: Target Folder: C:\Shared\BiscuitTin +05-05-2025 14:30:15 INFO: Security Group: KITCHEN\FS - RO - Shares - Biscuit Tin +05-05-2025 14:30:15 INFO: Permission: Read +05-05-2025 14:30:17 INFO: Found 12 folders and 47 files to process +05-05-2025 14:30:17 INFO: Applied permissions to folder: C:\Shared\BiscuitTin\Recipes +05-05-2025 14:30:17 INFO: Applied permissions to folder: C:\Shared\BiscuitTin\Financial +05-05-2025 14:30:18 WARNING: Failed to apply permissions to folder 'C:\Shared\BiscuitTin\Secure': Access is denied +05-05-2025 14:30:18 INFO: Applied permissions to file: C:\Shared\BiscuitTin\recipe_chocolate_chip.docx +05-05-2025 14:30:18 INFO: Applied permissions to file: C:\Shared\BiscuitTin\recipe_ginger_snap.pdf +05-05-2025 14:30:19 ERROR: Failed to apply permissions to file 'C:\Shared\BiscuitTin\Financial\secret_recipe.xlsx': The process cannot access the file because it is being used by another process. +05-05-2025 14:30:22 INFO: Processing complete. Successfully processed 56 items, 3 failures. +05-05-2025 14:30:22 INFO: Total items: 59 +05-05-2025 14:30:22 INFO: Log file created at: C:\Logs\ApplySecurityGroup\ApplySecurityGroup_05-05-2025.log +05-05-2025 14:30:22 WARNING: Warning: Some items failed to process. Check the log for details. +``` \ No newline at end of file