SharePoint PowerShell – a newbie’s findings

Yes, at this point in my life, I’m very new to PowerShell, and I’m okay with that. I was hesitant to make the jump, especially for use with SharePoint. Using stsadm for the last 7 years has been my security blanket. PowerShell, the new kid on the block, appeared to be threatening, almost bully like.

I decided, like most bullies, to figure out why he’s the bully, why is he acting this way, and give him a hug anyway. I found that PowerShell isn’t a bully. It’s a wonderful new world of extensions and options well beyond stsadm. As a developer, I quickly saw potential for PowerShell in so many areas.

Actually, as a developer, I discovered that it is more of a programming language than a command line tool, if that makes sense. If you’re not a developer, that’s okay, you don’t have to be. There’s a lot of help out there in finding almost anything you want to make PowerShell do.

There’s a lot of scripts available for the typical administrator, which will run a set of PowerShell commands to complete most tasks needed, inside and outside of SharePoint. There’s a whole new worlllddd… for youuu annnd meee….

So if you’re thinking about using PowerShell or want to understand it more, just do it, it’s worth it. I started in by reading Microsoft SharePoint 2010 Unleashed (Chapter 7), a good start into what PowerShell can do, especially for SharePoint. I’m sure there are other PowerShell resources out there.

As I dove in deeper, the more PowerShell felt like C#, and I found myself referencing the SharePoint API in the same manner I would in C#. Instead of creating a large Visual Studio project for some tasks, I can write a single file PowerShell script to so the same thing. Pretty sweet.

During my learning process, I created a few scripts which I would like to share below. They’re part of my sp2010adminpack.codeplex.com project. Use if you’d like, critique if you want.

Manage-Sites.ps1

Sorry, I’m no good at naming these things. This script is a growing effort, see the CodePlex project to check out any updates. This script walks you through your web applications, site collections and then to your sites. Allows you to back up your site collections, and view a list of all lists and libraries including their type and item count. I’m looking for more ideas and functionality to add to this.

Create-SiteCollection.ps1

This script simply creates a new site collection. This script will collect the web application you want to create it in, and the name and URL of the new site collection. Then BLAMO, a new site is created and opens in IE for you.

Backup-SiteCollections.ps1

The script loops through all of your web applications and site collections and backs them all up. Backups are prefixed with current time. Edit the file to specify your back up settings and then set it on a schedule and forget it.

Download the scripts from CodePlex

So the big bully has been won over, and I’ve fallen in love with it. I was a little worried that PowerShell would minimize the need for a developer, since you can do so much through it, but you still need that skill set to understand what it’s doing, and how.

 

 

 

 

 

 

 

 

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s