Home Contact

The Frog Pond of Technology

Ripples of Knowledge for SharePoint and Other .Net Technologies

News

 Subscribe to this blog


About Me

Name:
Brian T. Jackett
Location:
Columbus, OH
Company:
Microsoft

Find me on...

Tag Cloud


Archives

Post Categories

Syndication:

PowerShell Script to Limit SharePoint Site Templates Available

   I had a customer request recently to limit the which site templates were available to end users to create subsites.  Below is a short PowerShell script to do just that.

 

Problem

   If you are using a Publishing Site you can restrict the available site templates by going to Site Settings –> Look & Feel and clicking on Page Layouts and Site Templates (see following screenshot).  If you are not on a Publishing Site then there is not an easy (supported) way to accomplish this through out of the box means.

LimitSPSiteTemplates1

 

Solution

   The SPWeb class has methods GetAvailableWebTemplates and SetAvailableWebTemplates that can be used in conjunction with each other to get the current list of templates and then filter down to only the desired templates.  The filtered down results can then be set and updated on the SPWeb.  A version of this script can be downloaded from the TechNet Script Repository: Limit available web templates for a SharePoint site.

Note:  Be sure to modify the “<URL of site>” to your site’s URL and also change which templates to keep (line 2).

 

001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018

# array of template names (not titles) to keep
$templateNamesToKeep = "STS#0","PROJECTSITE#0","BLOG#0"

Start-SPAssignment -Global
$web = Get-SPWeb <URL of site>

# get the existing web templates from the site that will be filtered down
# 1033 is the locale id for English US (en-us), be sure to change to your locale

$existingWebTemplates = $web.GetAvailableWebTemplates(1033)
$newWebTemplates = New-Object "System.Collections.ObjectModel.Collection[Microsoft.SharePoint.SPWebTemplate]"

# filter existing web templates and only keep if in the list of template names to keep
$newWebTemplates = $existingWebTemplates | Where-Object {$_.name -in $templateNamesToKeep}
$web.SetAvailableWebTemplates($newWebTemplates, 1033)
$web.Update()

Stop-SPAssignment 
-Global

 

   Before you run the script you will see the original list of available web templates when creating a subsite.

LimitSPSiteTemplates2

 

   After you run the script you will now see only the templates which you listed in the templates to keep.

LimitSPSiteTemplates3

 

   If you need to reset the list of available web templates you can execute the AllowAllWebTemplates method on the SPWeb object.

 

Conclusion

   I had run across a few other samples for limiting web templates that involved modifying out of the box SharePoint files (changes which may be overwritten by future updates or patches, and thus not recommended).  This process of using the SetAvailableWebTemplates() method appears to be a bit more safe and supported.

 

      -Frog Out



Goals for 2014

   This is getting published a little bit late (month and a half into 2014 already) but I still wanted to get this posted.  Once again I’m setting some goals for myself for the year and posting them here publicly.  You can read my past years goals (2010, 2011, 2012, 2013) and retrospectives (2010, 2011, 2012, 2013) as well.  So with that let’s dive in.

 

Professional

  • Blogging – I’m coming up on 5 years of blogging in a few months.  Hard to believe it has been that long but as long as I have things to share I’ll continue blogging.  It is great when I meet people in person that have been helped by tips, scripts, or other content I have blogged about.  This year I know will be busy with a number of work projects but I plan to post at least one post of substance each month.
  • Publish a productivity tool – When I started blogging back in 2009 the second blog post I ever posted was about how to enumerate SharePoint permissions from SharePoint 2007 with PowerShell.  Last year in 2013 I posted an update for enumerating SharePoint 2010 or 2013 permissions with PowerShell.  I would like to take the updated script and turn it into a tool that works for SharePoint Online as well since I see this as a gap area in tools / reports currently available for SharePoint Online.

 

Personal

  • Continue taking annual vacations – This may seem like an odd goal, but taking some time off and disconnecting from work for a few days away from home is good at least once or twice a year.  I also try to disconnect from technology while I’m away so minimal or no email, TV, video games, computers, etc.  The next two goals help with sticking to that.
  • Running – In 2013 my wife (then fiancé) and I ran our first 5K.  You can read the backstory on why that was such a big deal for me.  This year I plan to run a quarter marathon (6.55 miles) and at least one other race (length undetermined).  I’m already signed up to run a quarter marathon in May and I”d like to do one other race, perhaps something like Warrior Dash.
  • Read books – As I mentioned in my 2013 retrospective I’ve really gotten into reading (physical, not just digital) books lately.  I plan to read at least 3-4 books, many which I got as Christmas presents last year (see below).  I’m really loving science fiction books (especially Isaac Asimov) lately and looking forward to finishing up the Foundation series.

WP_20131228_002

  • Buy a house – My wife and I are looking to move into something a little larger so we have room to expand our family in the coming years.  We’re also preparing our condo for selling it by completing some home projects.  Will be fun to break out some power tools.

 

Conclusion

   As I said with last year’s goals I like publicly posting my goals to hold myself more accountable but also to help inspire others to also create / post their own goals.  If you decide to post your own goals feel free to send me a link as I would love to read.  Here’s to a good 2014 year!

 

      -Frog Out



Goals for 2013 Retrospective

   This is my fourth year of setting goals publicly on my blog (2010, 2011, 2012, 2013) and going through a retrospective at the end of the year (2010, 2011, 2012).  So without further ado here is my recap of 2013 goals.

 

Year in Review

   2013 will probably be the biggest year in my life as it is the year I got married to my wonderful wife Sarah.  Other notable events include getting promoted to Senior Premier Field Engineer at Microsoft, two of my sister-in-laws having babies, and helping out with some local conferences (including the return of SharePoint Saturday Columbus).

 

Professional Goals

  • Work local more – For the majority of 203 I was still on the road for a good portion of it.  Thankfully towards the end of the year (just before my wedding) I was able to work out arrangements to do more local and remote work.  I now have a few dedicated customers that are local or I work with remotely.  That fills over half my schedule while the other portion of my time is doing a mix of remote and traveling engagements.  Overall I’m (and my wife is) much happier with me being able to be home more.
  • Mentor / Mentee – I started out the year with 2 unofficial mentees at work.  Over the course of the year they have dropped off and we don’t meet regularly anymore.  I still talk with one on an infrequent basis when questions arise.  I’m ok with where things are at on this topic as a mentor / mentee relationship is only beneficial while both sides are willing to put something into it and also get something out of it.  In these cases both are now moving along from the hurdles they originally faced.
  • Blogging – I planned to blog at least 20 posts last year.   Unfortunately I only wrote 18 posts.  Part of this is due to my daily schedule changing quite a bit between work and personal life and part of it is due to not keeping a regular rhythm of writing down blog ideas that I flesh out.  Currently I have a number of topics that I “haven’t had time” to write out.  What that really means is I haven’t made the time for it.  Something to work on for next year.

Personal Goals

  • Get married – As I mentioned above this was the big year I tied the knot with Sarah.  Three months in and married life is great.  We are both growing into our new relationship with each other and with God.
  • Stay Fit – In 2012 I was able to lose and keep off 10+ pounds.  In 2013 with the help of my FitBit One, going to the gym with my wife, practicing portion control during meals, and getting into running I took off another 5 pounds.  I would’ve liked to lose a few more pounds but I’m finding that I’m adding muscle weight which I’m ok with.
  • Read Books – 2013 was the year that I discovered science fiction books.  I had listened to some audio books (most of the Robot series) by Isaac Asimov a few years ago.  This year I found the first five books of the Foundation series at a local used book store.  I’ve already read through the first 4 and have books 5-7 lined up to be read.  I also read The Gods themselves by Asimov, Daemon and FreedomTM by Daniel Suarez, and Dance with Dragons by George R. R. Martin.  That is more books / pages than I read when I was back in school.  I asked for (and got as presents) a number of other science fiction and technology thriller books for Christmas so my reading list for 2014 is already stocked.  I’m finding that I really like owning physical books rather than digital lately, similar to my new fascination with board / card / dice games (I’ll talk more about in my goals for 2014).

 

Conclusion

   I changed the focus of many of my goals for 2013 compared to 2012.  I’m happy with the change in focus to more family and personal health type goals.  I was able to meet and exceed most goals with only a few that were not met completely.  After reflecting back on this past year I’ve already brainstormed some goals for 2014.

   I hope you had a good 2013 and that you set and stuck to some goals.  If you’d like to share any feel free to put them in the comments below.  Here’s to the start of a great 2014!



Guest Blog Post on Hey Scripting Guy Blog – STSADM Replacement

   Quick blog post here to let you know that I wrote a guest blog post for Ed Wilson (The Microsoft Scripting Guy) over on the Hey Scripting Guy blog.  The post is titled “Weekend Scripter: Using PowerShell to Replace STSADM” and covers some research I did into replacing the functionality of the “STSADM –o enumallwebs” command with PowerShell.  Feel free to give it a read and let me know if you have any feedback or comments.   Have a great end of this 2013 year.

 

      -Frog Out

 

Links

Weekend Scripter: Using PowerShell to Replace STSADM

http://blogs.technet.com/b/heyscriptingguy/archive/2013/12/29/weekend-scripter-using-powershell-to-replace-stsadm.aspx



Slides from Dog Food Conference 2013

   Thanks to the organizers, attendees, and sponsors from Dog Food Conference 2013.  It was a very packed conference but lots of great speakers and discussions going on.  Thanks to the attendees for my session.  Below is a link to my slides from my session on Social in SharePoint.  I look forward to participating in future Dog Food Conferences.

 

 

      -Frog Out



Speaking at Dog Food Conference 2013

DogFoodLogo

   It has been a couple years since I last attended / spoke at Dog Food Conference, but on Nov 21-22, 2013 I’ll be speaking at Dog Food Conference 2013 here in Columbus, OH.  For those of you confused by the name of the conference (no it’s not about dog food), read up on the concept of dogfooding .  This conference has a history of great sessions from local and regional speakers and I look forward to being a part of it once again.  Registration is now open (registration link) and is expected to sell out quickly.  Reserve your spot today.

 

Title: The Evolution of Social in SharePoint

Audience and Level: IT Pro / Architect, Intermediate

Abstract: Activities, newsfeed, community sites, following... these are just some of the big changes introduced to the social experience in SharePoint 2013. This class will discuss the evolution of the social components since SharePoint 2010, the architecture (distributed cache, microfeed, etc.) that supports the social experience, Yammer integration, and proper planning considerations when deploying social capabilities (personal sites, SkyDrive Pro and distributed cache). This session will include demos of the social newsfeed, community sites, and mentions. Attendees should have an intermediate knowledge of SharePoint 2010 or 2013 administration.

 

      -Frog Out



Slides and Script Samples from SharePoint Saturday Columbus 2013

   A big thanks to everyone who attended my “Integrating SharePoint 2013 and Office Web Apps Server” presentation this past weekend at SharePoint Saturday Columbus 2013.  Below you can find a link with the slides and PowerShell script samples that I demoed.  Also a big thanks to all of the organizers and other speakers who made it a great event.  Always great to catch up with old friends and make new connections.

   For those of you interested in more SharePoint community in Columbus, OH feel free to join us at the Buckeye SharePoint User Group (BuckeyeSPUG) each 3rd Thursday of the month at the Microsoft building near the Polaris mall.

 

 

      -Frog Out



Speaking at SharePoint Saturday Columbus 2013

SPSFull_BuckeyeBlack_Speaking

   It has been 2 years since the last SharePoint Saturday Columbus but thankfully a new group of organizers is taking up the mantel and putting on a new conference this year.  I am honored to be speaking at this year’s event.  Registration is already filled up but if you want to get on the waiting list please do so.  If you’ll be attending feel free to join my session or track me down in the halls to say hi.  Looking forward to a great event, speakers, and attendees.

 

SharePoint Saturday Columbus 2013

Title: Integrating SharePoint 2013 with Office Web Apps (WAC) Server

Audience and Level: IT Pro / Architect, Intermediate

Abstract: WAC? WOPI? These are some of the new acronyms for Office Web Apps (WAC) Server 2013. This session will highlight what has changed since the 2010 version, what is new for the 2013 version, and how to administrate WAC. We will also cover considerations for capacity planning, installation, high availability, and common pitfalls when deploying WAC. This session will include demos of how to configure WAC server with SharePoint 2013 and how to enable user license enforcement for editing documents through WAC. Attendees need not have prior experience with Office Web Apps but should have an introductory knowledge of SharePoint 2013 administration.

 

      -Frog Out



PowerShell Script to Workaround No Data in SharePoint 2013 Usage Reports

   Over the past few months I’ve had 2 customers that have run into an scenario where the SharePoint 2013 web analytics usage reports have no data (all zeroes) in the reports.  While working with some brilliant Microsoft escalation engineers (thanks Anthony and Jason) we were able to run some PowerShell scripts that added receivers to start data showing again on the following day.  Since I haven’t seen any posts on this as of yet I thought I would post a version of the PowerShell scripts we used.

 

Scenario

    In SharePoint 2013 the search service application incorporates web analytics (which is a separate service application in SharePoint 2010).  Web analytics processes usage logs on the SharePoint machines and generates reports on a daily schedule.  These reports can be viewed for an individual site in the site settings under Site Collection Administration > Popularity and Search Reports.

UsageReportDataEmpty1

 

   In the Popularity and Search Reports you can click on the Usage report which will launch an Excel workbook.

UsageReportDataEmpty2

 

   What I found with 2 customers and one of my lab farms was that the Usage report contained all zeroes for data even though the customer (and me in my lab farm) had been using the site regularly with multiple accounts over the past few days.

UsageReportDataEmpty3

 

   We analyzed the logging database and found that it had usage data, but the search analytics database did not.  (Note: do not directly query the search analytics database as that is unsupported as of the time this post was written.  See http://technet.microsoft.com/en-us/library/cc678868.aspx for more information.)  So it appeared the data in the logging database wasn’t being processed by the search service web analytics timer jobs.  After verifying that the timer jobs were indeed running the long road of PowerShell queries into the system began.  We finally used the below commands to arrive at what we believe to be the culprit for these customers.  Our findings follow the commands.

 

001
002
003
004
005

$aud = Get-SPUsageDefinition | where {$_.Name -like "Analytics*"}
$aud | fl

$prud = Get-SPUsageDefinition | where {$_.Name -like "Page Requests"} 
$prud | fl

 

  • AnalyticsUsage usage definition had no Receivers defined
  • PageRequest usage definition had no Receivers defined

UsageReportDataEmpty4

 

    Not having any Receivers defined also led to the EnableReceivers property to be set to false for both.

 

Workaround

   The workaround in these scenarios was to manually create the Receivers.  The PowerShell commands to do so is below (slightly modified to check for empty receivers first).  Again this sample script is provided as-is with no warranty.  Do not run this in your environment without first testing.  This is not an official Microsoft approved script.  You can download a copy off my SkyDrive folder as well.

 

 

001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018
019
020
021
022
023
024
025
026
027
028
029
030
031
032
033
034
035
036
037
038
039
040

if((Get-PSSnapin -Name Microsoft.SharePoint.PowerShell) -eq $null)
{
   
Add-PSSnapin Microsoft.SharePoint.PowerShell
}


$aud = Get-SPUsageDefinition | where {$_.Name -like "Analytics*"}

# if analytics usage definition receivers is empty then manually add back receiver
if($aud.Receivers.Count -eq 0
)
{
   
$aud.Receivers.Add("Microsoft.Office.Server.Search.Applications, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c", "Microsoft.Office.Server.Search.Analytics.Internal.AnalyticsCustomRequestUsageReceiver"
)
}


# if analytics usage definition receiver is not enabled then enable it
if($aud.EnableReceivers -eq $false
)
{
   
$aud.EnableReceivers = $true
    $aud.
Update()
}


$aud | fl


$prud = Get-SPUsageDefinition | where {$_.Name -like "Page Requests"} 

# if page requests usage definition receivers is empty then manually add back receiver
if($prud.Receivers.Count -eq 0
)
{
   
$prud.Receivers.Add("Microsoft.Office.Server.Search.Applications, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c", "Microsoft.Office.Server.Search.Analytics.Internal.ViewRequestUsageReceiver"
) 
}


# if page requests usage definition receiver is not enabled then enable it
if($prud.EnableReceivers -eq $false
)
{
   
$prud.EnableReceivers = $true
    $prud.
Update()
}


$prud | fl

 

   After the script has been run the output from the prior commands can confirm that Receivers have been created and the EnableReceivers property is set to true.

UsageReportDataEmpty5

 

<Update 2013-08-09>

   The next step is to recycle the OWSTimer service (SharePoint Timer Service) on each server.  This ensures that the new receivers are properly picked up by the timer jobs.

</Update 2013-08-09> 

  Waiting one day the usage reports were now showing data.  (Note the below report was mocked up manually to show data as I did not have direct access to the customers’ reports, but this is consistent with what we had seen after the scripts were applied.)

UsageReportDataEmpty6

 

Conclusion

   This is a strange scenario of no data in the usage reports when there is data in the logging databases.  I’ve run into it myself and with 2 customers, but when I tried to reproduce the scenario I couldn’t.  If anyone is facing this issue hopefully this process of manually creating the usage definition receivers and waiting 24 hrs is a workaround.  Let me know if you have seen this and if the workaround works for you.  Curious to learn more on it.

 

      -Frog Out



Slides from SPTechCon Boston 2013 Evolution of Social in SharePoint Presentation

   Below are my slides for my SPTechCon Boston 2013 session for “The Evolution of Social in SharePoint 2013”.  I made some last minute updates that will make their way over to the SPTechCon site as well, but for now here they are.  If you attended thanks for coming and I’d love to hear any feedback.  It was a great time presenting at SPTechCon again, sharing knowledge, and connecting with folks..

 

 

      -Frog Out