write-host "Generating CPU utilization report" -fore Magenta.The following piece of code automates the determination of the health analyzer reports: write-host "Disk space report generated" -fore green.$drives = Get-WmiObject -ComputerName $serverName Win32_LogicalDisk | Where-Object.write-host "Generating disk space report for server" $serverName -fore yellow.write-host "Generating Disk space report" -fore Magenta.write-host "AppPool status report generated" -fore green.$AppPool.name + "," + $Status + "," + $serverName| Out-File -Encoding Default -Append -FilePath $Output.if ($AppPool.getstate().returnvalue -eq 1).$AppPools = gwmi -namespace "root\webadministration" -Class applicationpool -ComputerName $serverName -Authentication PacketPrivacy -Impersonation Impersonate.write-host "Generating AppPool status report for server" $serverName -fore yellow.write-host "Generating AppPool status report" -fore Magenta.The following piece of code automates the determination of the AppPool status: write-host "IIS website report generated" -fore green.if ($site.getstate().returnvalue -eq 1).$Sites = gwmi -namespace "root\webadministration" -Class site -ComputerName $serverName -Authentication PacketPrivacy -Impersonation Impersonate.write-host "Generating IIS website report for server" $serverName -fore yellow."WebSiteName" + "," + "WebsiteID" + "," + "WebSiteState" + "," + "Server" | Out-File -Encoding Default -FilePath $Output.write-host "Generating IIS website report" -fore Magenta.The following piece of code automates the determination of the IIS website details: write-host "SP services report generated" -fore green.$service.displayname + "," + $service.status + "," + $service.MachineName | Out-File -Encoding Default -Append -FilePath $Output.$services = Get-Service -ComputerName $serverName -Name $Monitor -ea silentlycontinue.$Monitor = "SPAdminV4", "SPTimerV4", "SPTraceV4", "SPUserCodeV4", "SPWriterV4", "OSearch14", "W3SVC", "IISADMIN", "C2WTS", "FIMService", "FIMSynchronizationService".write-host "Generating SP services report for server" $serverName -fore yellow.if ($instance.TypeName -eq $timerServiceInstanceName).# If the server has the timer service then stop the service.foreach($instance in $server.ServiceInstances).write-host "Generating SharePoint services report" -fore Magenta.The following piece of code automates the determination of the SharePoint services status: Note: This functionality of consolidating files into Excel only works if you have an Excel client installed. This is done to consolidate all the reports into a single file and provide it to the customer or upper management for better readability. There is a separate function that converts all the CSV files into an Excel sheet with tabs separated for each of the CSV file. The script generates output in CSV files for each of the preceding tasks. There is one more function that is included with this script. So the PowerShell script would become handy in this scenario. Manually doing these tasks consumes time and human error can occur. The daily monitoring script automates the following tasks and captures the information into CSV files: This article outlines how to automate some of the tasks for daily monitoring. You can then differentiate monitoring into the 3 categories daily, weekly and monthly. Monitoring should be done at specific time intervals. From a SharePoint administration perspective monitoring tasks are very important for maintaining a healthy Farm.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |