Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 7025

Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 2162

Deprecated: Hook imagify_allow_picture_tags_for_webp is deprecated since version 2.2! Use imagify_allow_picture_tags_for_nextgen instead. in /www/collab365_296/public/wp-includes/functions.php on line 5758
Monitoring SharePoint Services using PowerShell - Collab365
Deprecated: strstr(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1145

Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1152

Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1155

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1162

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1165

Deprecated: strstr(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1145

Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1152

Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1155

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1162

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1165

Warning: Undefined array key "url" in /www/collab365_296/public/wp-content/plugins/thrive-visual-editor/thrive-dashboard/inc/smart-site/classes/class-tvd-smart-shortcodes.php on line 85

2014-09-04

Requirement

  • To monitor the SharePoint service.
  • Send a mail as HTML to monitoring team and SharePoint admins.

Solution

  • Copy the CSS code and save as STYLE.CSS in C drive
  • Copy the PowerShell script and do changes as required (Server Name, Email Address and SMTP Servers)
  • Execute the script as FARM administrator

PowerShell Code

################################################################### 
# Script : To Monitor SharePoint Services in Farm 
# Developer : Chendrayan Venkatesan 
# Contact : Chendrayan.Exchange@hotmail.com 
################################################################### 
 
 
$servers = "A" , "B" , "C" , "D" 
$Monitor = "SPAdminV4" , "SPTimerV4" , "SPTraceV4" , "SPUserCodeV4" , "SPWriterV4" , "OSearch14" , "W3SVC" , "IISADMIN" 
 
foreach($s in $servers) 
{ 
$services += Get-Service -ComputerName $s -Name $Monitor | select -Property DisplayName , Status , MachineName | 
ConvertTo-Html -Fragment 
 
} 
 
ConvertTo-Html -Body "$services" -CssUri "C:\style.CSS" -Title "SharePoint Services" |  
Out-File D:\SharePoint2010_Farm_Document\SharePoint_Services.html 
 
#Send Mail 
$From = "Mail Address" 
$To = "Valid Mail Address" 
$smtp = "Your SMTP Server Name" 
$Reports = Get-Content D:\SharePoint2010_Farm_Document\SharePoint_Services.html 
 
Send-MailMessage -To $To -From $From -Attachments D:\SharePoint2010_Farm_Document\SharePoint_Services.html -Subject "Farm Services" -SmtpServer $smtp

 

Reference Link

http://gallery.technet.microsoft.com/scriptcenter/SharePoint-using-PowerShell-6bfcb5da

(Visited 114 times, 1 visits today)

About the author 

Chendrayan

Summit Bundle

Get 200+ hours of Microsoft 365 Training for 27$!

Master Office 365, Power Platform & SharePoint & Teams With 200+ Hours Of Training Videos and 108 Ebooks in the Collab365 Academy. This offer is insane and is only available for a limited period.