$CentAdm = Get-SPWebApplication -includecentraladministration | where {$_.DisplayName -eq "SharePoint Central Administration v4"}| Select Url;
$CentAdm1 = Get-SPAlternateURL -WebApplication $CentAdm.url -Zone Intranet
#Write-Host $CentAdm1.PublicUrl;
$CentAdm2 = "$($CentAdm1.PublicUrl)/_admin/WebApplicationList.aspx";
#Write-Host $CentAdm2;
####get all services for web applications
$contentWebAppServices = (Get-SPFarm).services |
? {$_.typename -eq "Microsoft SharePoint Foundation Web Application"}
$Temp="<html><body style='font-family: calibri; font-size: 10pt; '><table style='border: 1px solid black; background: #E5E4E2;'><th >Activated Web Application</th>";
foreach($webApp in $contentWebAppServices.WebApplications)
{
#####get designer enabled web application
if ($webApp.AllowDesigner -eq "true")
{
$Temp +="<tr><td style = 'border: 1px solid black; padding: 5px;'> $($webApp.DisplayName) </td><td style = 'border: 1px solid black; padding: 5px;'> $($webApp.url) </td></tr>";
}
}
$Temp+="</table></body></html>";
$smtp = "smtp.something.something"
$to = "abc123.gmail.com","abc1234.gmail.com","abc12345.gmail.com"
$cc = "abc129.gmail.com","abc1275.gmail.com"
$from = "abc.dummyorg.com"
$subject = "Designer Activated Web Applications"
$body = "<span style='font-family: calibri; font-size: 11pt;'>Below are the Web Application's on which SharePoint Designer is Activated. </span> <br><br> "
$body += $Temp
$body += "<br><p style='font-family: calibri; font-size: 11pt;'>Please click <a href=$CentAdm2>Here</a> to deactivate SharePoint designer </p>"
$body += "<br><p style='font-family: calibri; font-size: 12pt;'>This is system generated email, please do not reply!</p>"
####send the email using \> Send-MailMessage
send-MailMessage -SmtpServer $smtp -To $to -Cc $cc -From $from -Subject $subject -Body $body -BodyAsHtml -Priority high
####Final Result will be displayed as below.
No comments:
Post a Comment