Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
How to Run a Power Shell Script in SharePoint 2010
WhatsApp
Destin Joy
14y
72.1k
0
0
100
Article
In this article I am showing you how to execute power shell scripts. It is useful if you want to do the same set of command regularly. You don't have to type the entire command again just run the script as I shown below
Here I am taking the example of creating a site collection using power shell I already have an article for it Please find the article url below
http://www.c-sharpcorner.com/UploadFile/Roji.Joy/3927/Default.aspx
The command to create a site collection is
$template = Get-SPWebTemplate "STS#0"
New-SPSite -Url "your Site collection URL" -OwnerAlias "domain\user" -Template $template
First step is to copy your script to a note pad and save as with .ps1 extension
In my case I saved the script as SiteCollection.PS1 and saved in my D drive under the folder Script. Now we have to open the power shell.
On the Start menu, click All Programs.
Click Microsoft SharePoint 2010 Products.
Click SharePoint 2010 Management Shell.
At the Windows Power Shell command prompt type the following command:
You will get a Power shell command prompt like below
The command to run Power shell script is
&"D:\Script\siteCollection.ps1"
Please find below the script in action
Power Shell Script in SharePoint 2010
Power Shell Script in SharePoint
Power Shell Script SharePoint
SharePoint Power Shell Script
Up Next
Ebook Download
View all
SharePoint Online And Office 365 Administration
Read by 3.6k people
Download Now!
Learn
View all
Membership not found