7/31/2010
LifeCycle Solutions - Home ( the software development blog )
 

<July 2010>
SunMonTueWedThuFriSat
27282930123
45678910
11121314151617
18192021222324
25262728293031
1234567

Subscribe to this feed:

RSS 2.0 | Atom 1.0 |CDF






Thursday, May 06, 2010

SharePoint 2010 has fairly rich Web Analytics and usage reporting functionality.  You can see plenty of useful stats and charts across your farm.  However, at farm level, it’s missing an important feature – email subscriptions.  In site collection admin, you can subscribe to stats for a given site collection, but in Central Admin (AFAIK), you can’t set up email subscriptions on the overall farm stats, or stats for an entire web app.

Hopefully, this feature will be added in the future, but as a quick fix, I whipped together a wonderful hack that can be used to scrape-and-send just about any of the reports- or other content as well.

$wc = new-object net.webclient
$cred = [System.Net.CredentialCache]::DefaultCredentials;
$wc.Credentials = $cred
 
$reportMarkup = $wc.DownloadString("http://yourcentraladmin/_layouts/WebAnalytics/Report.aspx?t=SummaryReport&l=wa&Id=http%3a%2f%2fyourserver%2f&WebAppName=YourWebApp&DURATION=7&CD=false&SHOWANALYZETAB=1")
$reportStart = $reportMarkup.IndexOf('<table class="ms-listviewtable"')
$reportEnd = $reportMarkup.IndexOf('</table>', $reportStart) + 8
$reportMarkup = $reportMarkup.Substring($reportStart, $reportEnd - $reportStart)
 
Send-MailMessage -To you@yourcompany.com -From sharepoint@yourcompany.com -Subject "Web Analytics" -Body $reportMarkup -BodyAsHtml -SmtpServer smtpiron

This script just downloads the page, scrapes the relevant area, and sends it off as email.  To use, you’ll need to fix up the url, scraping code, and mail addresses as needed, then schedule in scheduled tasks.

With a little more effort, you could even scrape together an ‘admin’ report to give you a quick glance at the most relevant Central Admin content such as health, analytics, and search crawl info.

Posted by Daniel Root

Wednesday, August 09, 2006

If you were intrigued by our previous post on PowerShell, but found it difficult to get started using notepad or your favorite text editor, try this:  PowerShellIDE.
In addition to having useful editor features (like IntelliSense and collapsing code blocks) it also uses the groovy new Office 2007 look and feel.  Free download, for now.

If you're interested in getting a good overview of PowerShell, here's a free e-book.

Posted by Brian Parks

© 2006 LifeCycle Solutions, LLC | All Rights Reserved