Automatic farm documentation
Requirement
I needed an easy way to automatically document my farm and take snap shots of its configuration periodically for audit purposes.
A quick search landed me on this Codeplex project by Jayvijw
As you can see from the above screenshot, the report is quite detailed and contains most of the information you would need as an administrator to track configuration changes and restore a farm to its original configuration if you ever have to start from scratch.
So I thought, why not use PowerShell and Windows Task Scheduler to give me weekly snapshots of my farm’s configuration?
Solution
Summary of what the script does
- Generate the farm configuration report using the 2010SPSFR.exe stored in C:\SharePoint
- Rename the report html file to our naming convention.
- Upload the report to a document library in SharePoint.
- E-mail a copy of the report to the SharePoint administrator.
Modify the variables in the script below to suit your environment. You can easily schedule this script in Windows Task Scheduler so that it generates reports periodically.
Add-PSSnapin Microsoft.SharePoint.PowerShell Write-Host "Script starting.." #Variables $ReportName = "c:\SharePoint\2010SPSFR.html" $ReportNewName = "SPFarm-Config-" + $(Get-Date -Format dd-MM-yy) + ".html" #Store a copy of the configuration file in a SharePoint library $Web = "http://your-site" $List = "FarmConfig" $AdminEmail = "your@email.com" $MailServer = "your.smtp.server.com" $FromAddress = "sharepoint.notifications@domain.com" #Run Automatic Documenting Program and rename the file CD C:\SharePoint Start-Process c:\SharePoint\2010spsfr.exe #Give the program 40 seconds to complete report generation. Start-Sleep 40 #Rename the report to a useful name Rename-Item -Path $ReportName -NewName $ReportNewName #Upload the file to SharePoint Function UploadToSPDocLib($LocalPath,$spDocLibPath) { $WebMethod = "PUT" $UploadFullPath = $spDocLibPath + $(split-path -leaf $LocalPath) $WebClient = new-object System.Net.WebClient $WebClient.Credentials = [System.Net.CredentialCache]::DefaultCredentials $WebClient.UploadFile($UploadFullPath, $WebMethod, $LocalPath) } UploadToSPDocLib "c:\sharepoint\$($ReportNewName)" "$($Web)\$($List)\" $messageParameters = @{ Subject = "SharePoint Farm: Test - Configuration Documentation" Body = "Please see attached file for the SharePoint farm documentation generated on $(Get-Date -Format dd-MM-yy)" From = $FromAddress To = $AdminEmail SmtpServer = $MailServer Attachments = "c:\sharepoint\$($ReportNewName)" } Send-MailMessage @messageParameters Write-Host "Done." |
2 Responses to Automatic farm documentation
Categories
Recent Posts
- Save document library as template option not available
- Short break
- Speed up SharePoint using the IIS Blobcache
- Could not generate mail report.An exception occurred while executing a Transact-SQL statement or batch.No global profile is configured. Specify a profile name in the @profile_name parameter.
- Microsoft SharePoint is not supported with version 4.0.30319.296 of the Microsoft .Net Runtime.
Popular Posts
- SharePoint Keeps Prompting for Credentials Problem SharePoint keeps prompting you for credentials in the following scenarios: You ...
- Security Token Service Application- Broken Problem Had an issue today on one of my developer's VMs. ...
- User Profile Service Stuck on Starting Problem You have followed Harbar's Rational Guide to setting up the ...
- Event 8313 Topology – Load Balancer EndpointFailure – SearchService.svc Problem Encountered the following error while analysing the logs on our ...
- Event 6398 and 5586 SharePoint Foundation Problem Event logs were getting filled with the following errors: Event 5586, ...
- The security validation for this page is invalid Problem: After applying SharePoint 2010 Service Pack 1 and June 2011 ...
- The local farm is not accessible. Cmdlets with FeatureDependencyId are not registered. Problem You install .NET Framework 4.0 on your SharePoint 2010 WFE ...
- Start a workflow using PowerShell Requirement Start a workflow on all / specific items in a ...
- Using Export-SPWeb to export libraries / lists This is a simple one but many people get the ...
- Unable to change User Profile Service Account Problem So you made a mistake by trying to change the ...
Tags
Backup and Restore Branding Content Management Content Organizer database Debugging Document Conversion Service DPM Event 7362 Expiration Policy IIS InfoPath Information Management Javascript KB2266203 Masterpage Migration Mysite OCS Office Page Layouts PowerPivot Powershell RBS Records Center Regional Settings Search Search Center Security Send-to Connection SharePoint Diagnostic Studio SharePoint Manager Solutions SPD Uploading Usage and Health Data Collection User Profile Service Visual Upgrade Web Analytics Web Content Management Webdav Webparts Workflow WSS XSLT


Can you please show me how could you published the HTML on your site?
Hi Nagi,the script publishes the html file to the SharePoint document library you specify. You only need to create the site and relevant document library.