Windows PowerShell (PS) is a shell scripting, provided by Microsoft. This is
mainly used for Windows and Server administration. This is very powerful tool
for administrators. Here we’ll cover basics of PowerShell. Refer http://msdn.microsoft.com/en-us/library/windows/desktop/aa973757(v=vs.85).aspx for
more details.
In this post I would give a start-up that how PowerShell is used for SharePoint.
Start: Assuming PowerShell is installed on your machine. Open the PS (PowerShell) console. [Start-> All Programs->Accessories -> Windows PowerShell]
Type Dir on blue console and enter-> Enter : It will show your directory information. Similarly we can do all kind of windows activities from this console. PS is packaged with large number of cmdlets, which are light weight commands to perform different activities, check http://msdn.microsoft.com/en-us/library/windows/desktop/ms714395(v=vs.85).aspx and http://technet.microsoft.com/en-us/scriptcenter/dd772285.aspx for details on PS cmdlets.
So now we know what PowerShell is and how to use it. Now, how to use this for SharePoint? SharePoint cmdlets are available in a snap in which should be added to Windows PS first to use it.
Type below command on console and enter [on SharePoint server]:
Add-PSSnapin Microsoft.SharePoint.PowerShell
Now, we are all set..
Enter Get-SPSite on console, hit Enter and you’ll get list of all the site collections available in your SP Farm.
Some important points:
1. SharePoint 2010 Management Shell is a PS console for SP packaged and installed with SP2010 and can be used directly, no additional snap-in required.
2. Login account need appropriate permissions on SP Server and SP Databases to execute cmdlets/scripts.
It’s just a beginning..
Happy scripting :)
In this post I would give a start-up that how PowerShell is used for SharePoint.
Start: Assuming PowerShell is installed on your machine. Open the PS (PowerShell) console. [Start-> All Programs->Accessories -> Windows PowerShell]
Type Dir on blue console and enter-> Enter : It will show your directory information. Similarly we can do all kind of windows activities from this console. PS is packaged with large number of cmdlets, which are light weight commands to perform different activities, check http://msdn.microsoft.com/en-us/library/windows/desktop/ms714395(v=vs.85).aspx and http://technet.microsoft.com/en-us/scriptcenter/dd772285.aspx for details on PS cmdlets.
So now we know what PowerShell is and how to use it. Now, how to use this for SharePoint? SharePoint cmdlets are available in a snap in which should be added to Windows PS first to use it.
Type below command on console and enter [on SharePoint server]:
Add-PSSnapin Microsoft.SharePoint.PowerShell
Now, we are all set..
Enter Get-SPSite on console, hit Enter and you’ll get list of all the site collections available in your SP Farm.
Some important points:
1. SharePoint 2010 Management Shell is a PS console for SP packaged and installed with SP2010 and can be used directly, no additional snap-in required.
2. Login account need appropriate permissions on SP Server and SP Databases to execute cmdlets/scripts.
It’s just a beginning..
Happy scripting :)
No comments:
Post a Comment