File Server Resource Manager (FSRM) Analyzer Tool
<# .SYNOPSIS File Server Resource Manager (FSRM) Analyzer Tool .DESCRIPTION This script analyzes and audits File Server Resource Manager configurations, including quotas, file screens, file groups, and classification rules on Windows Servers. .NOTES File Name : FSRMAnalyzer.ps1 Author : [Your Name] Prerequisite : PowerShell V5.1 or later, FSRM feature installed, and appropriate permissions Version : 1.0 Date : [Current Date] .EXAMPLE .\FSRMAnalyzer.ps1 #> # Check if FSRM module is available if (-not (Get-Module -ListAvailable -Name FileServerResourceManager)) { Write-Host "File Server Resource Manager module not found. Please ensure FSRM is installed." -ForegroundColor Red exit } # Import required module Import-Module FileServerResourceManager # Global variables $global:reportPath = "$env:USERPROFILE\Desktop\FSRM_Analysis_Report_$(Get-Date -Format 'yyyyMMdd_HHmmss').html" <# .SYNOPSIS Displays the main menu of the tool. #> function Show-Menu { Clear-Host Write-Host "=== File Server Resource Manager Analyzer Tool ===" -ForegroundColor Cyan Write-Host "1. Analyze Quota Templates" Write-Host "2. Review File Screen Templates" Write-Host "3. Analyze File Groups" Write-Host "4. Review Classification Rules" Write-Host "5. Check File Management Tasks" Write-Host "6. Analyze Storage Reports" Write-Host "7. Review FSRM Settings" Write-Host "8. Generate Comprehensive HTML Report" Write-Host "9. Exit" } <# .SYNOPSIS Analyzes Quota Templates. .OUTPUTS Array of PSObjects containing Quota Template details. #> function Analyze-QuotaTemplates { Write-Host "`nAnalyzing Quota Templates..." -ForegroundColor Yellow $quotaTemplates = Get-FsrmQuotaTemplate $results = @() foreach ($template in $quotaTemplates) { $results += [PSCustomObject]@{ Name = $template.Name Size = $template.Size SoftLimit = $template.SoftLimit ThresholdPercentages = $template.Threshold -join ", " } } $results | Format-Table -AutoSize return $results } <# .SYNOPSIS Reviews File Screen Templates. .OUTPUTS Array of PSObjects containing File Screen Template details. #> function Review-FileScreenTemplates { Write-Host "`nReviewing File Screen Templates..." -ForegroundColor Yellow $screenTemplates = Get-FsrmFileScreenTemplate $results = @() foreach ($template in $screenTemplates) { $results += [PSCustomObject]@{ Name = $template.Name IncludeGroup = $template.IncludeGroup -join ", " Active = $template.Active Description = $template.Description } } $results | Format-Table -AutoSize return $results } <# .SYNOPSIS Analyzes File Groups. .OUTPUTS Array of PSObjects containing File Group details. #> function Analyze-FileGroups { Write-Host "`nAnalyzing File Groups..." -ForegroundColor Yellow $fileGroups = Get-FsrmFileGroup $results = @() foreach ($group in $fileGroups) { $results += [PSCustomObject]@{ Name = $group.Name IncludePattern = $group.IncludePattern -join ", " ExcludePattern = $group.ExcludePattern -join ", " Description = $group.Description } } $results | Format-Table -AutoSize return $results } <# .SYNOPSIS Reviews Classification Rules. .OUTPUTS Array of PSObjects containing Classification Rule details. #> function Review-ClassificationRules { Write-Host "`nReviewing Classification Rules..." -ForegroundColor Yellow $classRules = Get-FsrmClassificationRule $results = @() foreach ($rule in $classRules) { $results += [PSCustomObject]@{ Name = $rule.Name Property = $rule.Property PropertyValue = $rule.PropertyValue Description = $rule.Description } } $results | Format-Table -AutoSize return $results } <# .SYNOPSIS Checks File Management Tasks. .OUTPUTS Array of PSObjects containing File Management Task details. #> function Check-FileManagementTasks { Write-Host "`nChecking File Management Tasks..." -ForegroundColor Yellow $fmTasks = Get-FsrmFileManagementJob $results = @() foreach ($task in $fmTasks) { $results += [PSCustomObject]@{ Name = $task.Name Namespace = $task.Namespace Action = $task.Action Enabled = $task.Enabled Schedule = $task.Schedule } } $results | Format-Table -AutoSize return $results } <# .SYNOPSIS Analyzes Storage Reports. .OUTPUTS Array of PSObjects containing Storage Report details. #> function Analyze-StorageReports { Write-Host "`nAnalyzing Storage Reports..." -ForegroundColor Yellow $reports = Get-FsrmStorageReport $results = @() foreach ($report in $reports) { $results += [PSCustomObject]@{ Name = $report.Name NameSpace = $report.NameSpace ReportFormats = $report.ReportFormats -join ", " Schedule = $report.Schedule } } $results | Format-Table -AutoSize return $results } <# .SYNOPSIS Reviews FSRM Settings. .OUTPUTS PSObject containing FSRM Settings. #> function Review-FSRMSettings { Write-Host "`nReviewing FSRM Settings..." -ForegroundColor Yellow $settings = Get-FsrmSetting $results = [PSCustomObject]@{ SmtpServer = $settings.SmtpServer AdminEmailAddress = $settings.AdminEmailAddress FromEmailAddress = $settings.FromEmailAddress CommandNotificationLimit = $settings.CommandNotificationLimit EmailNotificationLimit = $settings.EmailNotificationLimit EventNotificationLimit = $settings.EventNotificationLimit } $results | Format-List return $results } <# .SYNOPSIS Generates a comprehensive HTML report of all analyses. .PARAMETER AllResults Hashtable containing all analysis results. .OUTPUTS Saves an HTML report to the desktop. #> function Generate-HTMLReport { param([hashtable]$AllResults) Write-Host "`nGenerating Comprehensive HTML Report..." -ForegroundColor Yellow $reportContent = @" <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>FSRM Analysis Report</title> <style> body { font-family: Arial, sans-serif; line-height: 1.6; color: #333; max-width: 1200px; margin: 0 auto; padding: 20px; } h1, h2, h3 { color: #0078D4; } table { border-collapse: collapse; width: 100%; margin-bottom: 20px; } th, td { border: 1px solid #ddd; padding: 8px; text-align: left; } th { background-color: #f2f2f2; } </style> </head> <body> <h1>File Server Resource Manager Analysis Report</h1> <p>Generated on: $(Get-Date)</p> <h2>Quota Templates</h2> $($AllResults.QuotaTemplates | ConvertTo-Html -Fragment) <h2>File Screen Templates</h2> $($AllResults.FileScreenTemplates | ConvertTo-Html -Fragment) <h2>File Groups</h2> $($AllResults.FileGroups | ConvertTo-Html -Fragment) <h2>Classification Rules</h2> $($AllResults.ClassificationRules | ConvertTo-Html -Fragment) <h2>File Management Tasks</h2> $($AllResults.FileManagementTasks | ConvertTo-Html -Fragment) <h2>Storage Reports</h2> $($AllResults.StorageReports | ConvertTo-Html -Fragment) <h2>FSRM Settings</h2> $($AllResults.FSRMSettings | ConvertTo-Html -Fragment) </body> </html> "@ $reportContent | Out-File -FilePath $global:reportPath Write-Host "Report generated and saved to: $global:reportPath" -ForegroundColor Green } # Main program loop $allResults = @{} do { Show-Menu $choice = Read-Host "`nEnter your choice (1-9)" switch ($choice) { "1" { $allResults.QuotaTemplates = Analyze-QuotaTemplates } "2" { $allResults.FileScreenTemplates = Review-FileScreenTemplates } "3" { $allResults.FileGroups = Analyze-FileGroups } "4" { $allResults.ClassificationRules = Review-ClassificationRules } "5" { $allResults.FileManagementTasks = Check-FileManagementTasks } "6" { $allResults.StorageReports = Analyze-StorageReports } "7" { $allResults.FSRMSettings = Review-FSRMSettings } "8" { Generate-HTMLReport -AllResults $allResults } "9" { Write-Host "Exiting program..." -ForegroundColor Yellow; break } default { Write-Host "Invalid choice. Please try again." -ForegroundColor Red } } if ($choice -ne "9") { Read-Host "`nPress Enter to continue..." } } while ($choice -ne "9")
This File Server Resource Manager (FSRM) Analyzer Tool includes:
- A menu-driven interface for easy navigation.
- Functions to analyze various aspects of FSRM:
- Quota Templates analysis
- File Screen Templates review
- File Groups analysis
- Classification Rules review
- File Management Tasks check
- Storage Reports analysis
- FSRM Settings review
- Comprehensive error handling for each analysis function.
- A function to generate an HTML report of all collected data.
Key features:
- Detailed analysis of Quota Templates and their thresholds
- Review of File Screen Templates and their included file groups
- Analysis of File Groups and their patterns
- Examination of Classification Rules
- Overview of File Management Tasks and their schedules
- Analysis of configured Storage Reports
- Review of general FSRM settings like email configurations
- Comprehensive HTML report generation
This tool is particularly useful for:
- System administrators managing file servers
- Storage administrators overseeing quota and file screening policies
- IT auditors reviewing file server configurations
- Compliance officers ensuring adherence to file management policies
To use this script effectively:
- Run PowerShell as an administrator
- Ensure the File Server Resource Manager feature is installed on the server
- Have the necessary permissions to query FSRM configurations
This script provides a comprehensive overview of File Server Resource Manager configurations on a Windows Server, making it easier to audit and maintain FSRM policies, quotas, and file screening rules. It can significantly streamline the process of managing and documenting FSRM configurations in enterprise environments.
Leave a Reply
Want to join the discussion?Feel free to contribute!