12/11/2014 Updated the script to version 1.1 and provided a download link (see end of this blog post for more details).
PowerShell is a great automation language. What is nice about it, is that it is present in (almost) all of Microsoft palette. As a powerShell developer (Did some one said Devops?) we can technically work on anything as long as it has Powershell underlying on it. And that is really one of our strength! In today’s topic, we will discuss Powershell in Sharepoint.
Knowing the PowerShell language and syntax pretty well is really a strong asset. We can easily go from one (infrastructure) field to another. This implies that we often need to adapt to new technologies and learn their basic architecture components in order to be able to write a script that will not blow up the complete production environment.
Sharepoint is one these Microsoft technologies that is present EVERYWHERE. A lot of the huge companies out there use it for various different business scenarios. It really must be a great collaboration tool (I cannot give a strong opinion for my self, but that will come soon I guess). Yet every body seem to hate it. If you google “Why sharepoint sucks”, you will receive huge amount of results back. Anyways, ignoring all of this, I just start my day, with the task of adding a Specific AD group to several all of our Web site collections.
Ok, seems easy right?
I know that the architecture for a site is (in a very basic shape) like this:
- Web Application
- Site Collection
- Site Collection
It is pretty much comparable to standard file system hierarchy, so nothing to complicate there!
But when you take a look in the powershell cmdlets, it seems like they haven’t really respected the same naming convention (or at least, It is not as clear as I am used to with other products).
The three main cmdlets that will be used here are :
But, when I looked at their parameters I got confused. I created the following small mind map which helped to link which cmdlet was actually needed for what part of sharepoint.
Why is that important ? Well, what I actually needed to do, is to set read and write rights to all of the child sites of a specefic site collection.