Archive for the ‘SharePoint PowerShell’ Category

I cant believe that I didn’t know about this until today, even though I have been Power-shelling for a few years now!

In the Windows PowerShell Integrated Scripting Environment (ISE) you are able to insert logical snippets by setting your curser in the script pane and pressing the keys: Ctrl + j.

screen screen2

This means you can use less time remembering syntax and more time solving your tasks.

Happy Powershelling!

Often when automating your SharePoint solutions, you will find yourself adding custom customizations, like copying a picture file to a specific location on all your SharePoint servers. To do this we can for example use the following PowerShell code.


I think that title will be my longest ever:-)

Here you will find 3 Functions for starting,stopping and restarting windows services that can target specific servers, local servers and all sharePoint Servers.


When configuring your shiny new Service Applications using PowerShell, depending on the size of your SharePoint farm. You may want to be running some services on multiple SharePoint Servers. The code bellow consists of two functions to start and stop service instances per server.


Useful Powershell code to quickly find the database sizes in your SharePoint farm.

Get-SPDatabase | Sort-Object disksizerequired -desc | %{write-host  “Size: $($_.disksizerequired/1mb)MB – Database: $($_.Name)”}

Whether you are running a large custom-packed-WSP filled SharePoint 2013 Farm or a simple farm with a few different Web Applications, it could be nice to automate the deployment and removal process of WSP-packages to avoid any kind of manual work!

Here’s a way to deploy and remove groups of WSP packages to both -all Web Applications and -spesific Web Applications. The sky is the limit!


When setting up new Web Applications left and right, it can be very frustrating to enter the email settings on the Web Applications. Under is a code-snippet and a Function to set email settings on your Web Applications using PowerShell.


When being an active PowerShell user it can be handy to have your favourite modules and Snapin’s available on PowerShell Launch!
Every user on the server will have his/her own “location” ps1 file that probably does not exist at the moment. You will probably have to create it first.


When working on a specific farm, you may find that you have multiple farms per environment, for example:

Production, Stage, Test and Development farms.

It could be nice to be able to compare WSP packages and features across farms.

I’ve written a script (MapCheckFeature&WSP_Global.ps1) that has two options of MAP and COMPARE a farms’ (the ideal farm, FarmA) enabled features and its WSP solution status.


Earlier I would go on a server treasure hunt every time a Correlation Id hit me. This is what happens when working on a SharePoint farm that uses NLB. You never know where your SharePoint session is, and when an error occurs, the error is saved in the sharepoint log on that WFE server.Like most things in our daily lives, you can find the solution using Powershell!