How to use PowerShell to control your SharePoint SUT Platform remotely

Do you want to make your life easy by preparing SharePoint SUT server test data?

If you are still preparing test data or configuring the SUT manually, then you should change your habits now!

SharePoint Management is a tool to manage the SharePoint server. PowerShell will help you to increase efficiency.

Suppose that you already understand some PowerShell syntax, but you always log on to the SharePoint Server to configure the SUT again and again.

Get out of the technological Stone Age!!

Use PowerShell script to remotely control your SUT SharePoint Platform.

Suppose you want to test your product in different UIs of SharePoint2010. To do this, you have to use remote desktop to login on to the SharePoint server and then changed the UI version using a tool.

Not anymore, now you can use PowerShell script to remotely control the SUT instead.

Here is what you have to do:

Step one:

Enable PowerShell remotely with just one command.

Open the PowerShell console application and then enter “Enable-PSRemoting” and hit enter.


Enter [Y] to continue and you will have enabled using PowerShell remotely.

Step two:

Save the PowerShell script “UIVersion.ps1” on your own computer (Not on SharePoint). The script content is as follows:

$webUrl = Read-Host "Enter the web url"

$uiVersion = Read-Host "Enter the UI version 3 or 4"

$password = "yourpassword"

$securePassword = ConvertTo-SecureString $password -AsPlainText -Force



$credential = new-object Management.Automation.PSCredential(($domain+"\"+$userName),$securePassword)

$computerName = "br-pxl"

invoke-command -computer $computerName -Credential $credential -scriptblock{





Add-PsSnapin Microsoft.SharePoint.PowerShell

$web = Get-SPWeb($webUrl)

$web.UIVersion = $uiVersion;


echo "Finished!"

}-argumentlist $webUrl, $uiVersion

The key is the “invoke-command” command. You should set the computer name (SUT), credentials (user who controls SharePoint including user name, domain name and password) and write the SharePoint control script in the scriptblock.

Don’t forget to add Add-PsSnapin Microsoft.SharePoint.PowerShell.

Step three:

Execute the script then enter the web URL and UI version. You will see that the SharePoint site UI version has changed.

image003 image005 image007 image009

Leave a Reply