PowerShell, Scripting, Sharepoint, SharePoint2010
comments 4

SharePoint 2010 and PowerShell annoyances – Part 1: SharePoint backup

Microsoft and SharePoint product teams certainly did a good job by enabling out-of-box PowerShell management of SharePoint. It really provides some great power to IT professionals and administrators managing SharePoint farms. But, in my opinion, this is not the best implementation of PowerShell support. I will dig in to why I feel like that by quoting a few examples in each of these blog posts. Yes, I know, I could have written all this as product feedback during beta. But , nevertheless, I hope this reaches the product team at MS.

I will start this series with a couple of SharePoint 2010 backup cmdlets. To perform SharePoint 2010 backup, there are actually 3 cmdlets — Backup-SPFarm, Backup-SPSite, and Backup-SPConfigurationDatabase.


Backup-SPFarm -BackupMethod <String> -Directory <String> [-AssignmentCollection <SPAssignmentCollection>] [-BackupThreads <Int32>] [-ConfigurationOnly <SwitchParameter>] [-Confirm [<SwitchParameter>]] [-Force <SwitchParameter>] [-Item <String>] [-Percentage <Int32>] [-WhatIf [<SwitchParameter>]]

What is wrong with this cmdlet

In short, many things..!
1. There is no -AsJob parameter. I know it requires PS remoting infrastructure but I don’t want to wait at the console until full backup of my 200+ GB content DB is done..! Of course, the work around is to use Start-Job cmdlet. But, this is the least I expect from a out-of-box cmdlet.

2. By default, there is no output on the console unless you use -Verbose. This is insane. How do I know what the heck the command is doing?

3. I initially thought -percentage parameter is a great option. But no..! This is the most dumb parameter. Also, it requires -verbose. All it does is to show the progress information as a string in the verbose output stream. Now, how useful is that?

4. Why the heck we could not just use the out-of-box Write-Progress cmdlet?

We can combine Backup-SPFarm cmdlet with background jobs and do some parallel processing of log files to generate some nice output. A topic for another day.


Backup-SPSite -Identity <SPSitePipeBind> -Path <String> [-AssignmentCollection<SPAssignmentCollection>] [-Confirm [<SwitchParameter>]] [-Force <SwitchParameter>] [-NoSiteLock <SwitchParameter>] [-UseSqlSnapshot <SwitchParameter>] [-WhatIf [<SwitchParameter>]]

What is wrong with cmdlet

1. This expects you to give the path to a .BAK file where as Backup-SPFarm can use the directory path and dump all .bak files there. Why no consistency in parameters?

2. Where is the -Percentage parameter? Yeah, I know, I said its useless.

These things may look very trivial. But in the context of making things simpler and manageable, these small things create a big impact. This is it for today. I will write about few more cmdlets next time.

Filed under: PowerShell, Scripting, Sharepoint, SharePoint2010


Ravikanth is a principal engineer and the lead architect for Microsoft and VMware virtualized and hybrid cloud solutions within the Infrastructure Solutions Group at Dell EMC. He is a multi-year recipient of Microsoft Most Valuable Professional (MVP) award in Windows PowerShell (CDM) and Microsoft Azure. Ravikanth is the author of Windows PowerShell Desired State Configuration Revealed (Apress) and leads Bangalore PowerShell and Bangalore IT Pro user groups. He can be seen speaking regularly at local user group events and conferences in India and abroad.