Living a SharePoint life

Wednesday, January 21, 2015

Code Snippet: Iterating thru all websites

How to iterate thru all SiteCollections and containing the Websites. This script also shows a progressbar on screen:

$sites = Get-SPSite -Limit All
$siteIter = 0
foreach($site in $sites) {
    Write-Progress -PercentComplete (($siteIter / $sites.Count) * 100) -Activity "Iteration Sites" -Status $site.HostName
    $webIter = 0
    
    # Do something here
    
    foreach($web in $site.AllWebs) {
        Write-Progress -PercentComplete (($webIter / $site.AllWebs.Count) * 100) -Activity "Iteration Webs" -Status $web.Title -Id 2
        Write-Host $web.Title
        $webIter++
        
        # Do something here
    }
    $siteIter++
}

Code Snippet: Load the SharePoint PowerShell Module

How do you load the PowerShell module for SharePoint?

Addendum: I've added a try/catch block to the code. This way you can be sure the module is loaded.

# Loading SharePoint Module
try {
    if ((Get-PSSnapin "microsoft.SharePoint.Powershell" -ea silentlycontinue) -eq $null)
    {
        Add-PSSNapin Microsoft.SharePoint.Powershell
    }
}
catch {
    throw "Microsoft SharePoint PowerShell AddIn initialization failed"
    exit 3
}

Thursday, November 20, 2014

Remove the performance breaks when using VMWare 5.0 and Windows Cluster services


There are probably a lot of SharePoint Farms that use a Microsoft SQL cluster. Even now with new possibilities like Always-On for SQL 2012. But not only if you use SharePoint might this be of interest for you.

About a year ago, a customer of mine had some very bad performance with his SQL Server. The SQL was version 2008 R2 using the Windows Cluster Service hosted on a VMWare ESX 5.0 private cloud. Nothing unusual and of course the first thoughts were pointing to the VMWare servers. But let’s take a look at the performance test we performed on the cluster.

Wednesday, November 19, 2014

Log Parser Studio 2.2

Log files are a hassle. Too many entries and bad formatting make it a challenge to work with logs. So if you are already familiar with Microsofts LogParser, you’ll love to hear that there is an even better way to work with Log files.

Log Parser Studio is a Windows Tool that uses LogParser and gives you a GUI to work with. This way it's easier to create adhoc reports of your logfiles. You can export the query as a script and then automate your tasks.
http://gallery.technet.microsoft.com/office/Log-Parser-Studio-cd458765

LogParser
http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=24659

Getting Started with the Log Parser Studio
http://blogs.technet.com/b/karywa/archive/2013/04/21/getting-started-with-log-parser-studio.aspx

Tuesday, October 14, 2014

Fire up those caches

Picture by Caroline Gutman
If you’re working with SharePoint you probable heard already about something called the Warm-Up Script. It won’t keep you warm in the night and you must ask your partner or cat to do so. The Warm-Up script prefetches SharePoints ASPX pages and loads them into the IIS cache. This will help to improve the user experience. There are different approaches to do this. But beside of the script itself, the proper configuration will get things really started.

This post is

Thursday, September 25, 2014

Opening Word file from SharePoint 2010 causes Office to crash

Today I wasn’t able to open a Word file from the SharePoint Server. Every time I opened the document from the server, Word crashed. Saving the file to disk and opening it then worked just fine. What made it even worse was that SharePoint thought the file was opened exclusive for my user account and I couldn’t do any action on the file on the server e.g. deleting. Bugs! I don’t like them, but it’s always a good feeling when you found out how to get rid of ‘em.

Thursday, July 31, 2014

Creating a bookshelf with the Content Query Webpart in SharePoint

A lot of information these days comes in form of an eBook or similar format like a simple PDF. In SharePoint the easiest way to present this information to the user is as a list. For the more ambitious there is the metadata navigation, which brings a lot of beauty for handling list content. I will use a more sophisticated approach via the Content Query Webpart (CQWP) to present the information like books on the bookshelf.


Preparation


Before we can start, we’ll need to step back for a moment and think about the data structure we’ll need in order to support the view we are creating here. There are a few questions you must ask yourself:

  • Where and in which document library will you store you eBooks?
  • Will you mix different content types in that document library or will you create a new library for every document type?

In my case, I have more documents other than just eBooks. I’ve decided to keep all documents in a single document library and to identify the documents by their content type. Therefore, one of the first steps will be to create the library, the columns and the content type.
This post is

Thursday, July 24, 2014

SharePoint 2015 is peeking thru

Today I was working with the SharePoint Design Manager on Office365 when I found something interessting:

Wave 16 can already be selected in Office365

It seems like Microsoft is already testing Office Wave 16 in the field or at least preparing for it. It is possible to select the Option for SharePoint 2015, but you will get an error that uploading has been disabled by the administrator.

Featured Post

How are Microsoft Search quota consumed?

With Office 365 Search, Microsoft has created a central entry point for the modern workplace. In one convenient spot, users can access all ...