Showing posts with label PowerShell. Show all posts
Showing posts with label PowerShell. Show all posts

Tuesday, December 18, 2012

Adding and Deploying Solutions in SharePoint 2010

Adding and Deploying Solutions in SharePoint 2010
How we can add solutions in SharePoint 2010 ?
We can add solution via common line using either STSADM or PowerShell command while solution deployment can be done either via Central Admin or using STSADM or PowerShell

Command line:
Using STSADM:
stsadm.exe -o addsolution -filename yoursolutionpackage.wsp
Using PowerShell:
Add-SPSolution -LiteralPath <SolutionPath>

Now here comes deployment part
  • Deploy Solution using Central Administration
  • Open Central Administration
  • Go to System Settings
  • Click on Manage farm solutions
  • Select the solution from the list
  • Select Deploy Solution and select the web application where you want to deploy it
  • Click OK when you are done.
  • Click Deploy Solution
  • That’s all, we are done with deployment

Command line:
Using STSADM:
stsadm -o deploysolution -name yoursolutionpackagename.wsp -url http://sp-mach/ -local  -force
Using PowerShell:
Install-SPSolution -Identity <SolutionName> -WebApplication <URLname>

Uninstallation and Retraction of a Solution in SharePoint 2010

Uninstallation and Retraction of a Solution in SharePoint 2010

Using STSADM:
stsadm -o retractsolution -name solutionName.wsp -immediate
stsadm -o deletesolution -name solutionName.wsp

Using PowerShell:
Uninstall-SPSolution -identity solutionName.wsp
Remove-SPSolution -identity solutionName.wsp

Monday, November 5, 2012

Programmatically create a host-named site collection

In addition to using the Windows PowerShell to create host-named sites, you can use the SharePoint Server 2010 object model. The following code sample creates the host-named site collection with the URL http://host.header.site.url in the SharePoint Server 2010 Web application with the URL http://servername:


SPWebApplication webApp = SPWebApplication.Lookup(new
Uri("http://servername"));
SPSiteCollection sites = webApp.Sites;
SPSite Site = null;
Site = sites.Add("http://hoster.contoso.com", "Site_Title",
"Site_Description", 1033, "STS#0", "contoso\owner",
"Owner_Display_Name", "Owner_Email", "contoso\secondaryowner,
"Secondary_Owner_Display_Name", "Secondary_Owner_Email", true);

SharePoint Server 2010 ships with a set of Web services for various user and administrative tasks. One of these administrative tasks is creating a new site collection. The CreateSite Web service method does not support the creation of host-named site collections. A workaround for this issue is to write a Web service that wraps the API sample code.

Monday, July 30, 2012

Top 5 Free PowerShell Scripts for SharePoint‏



Top 5 Free PowerShell Scripts for SQL Server
Windows PowerShell provides an easy way to create SharePoint sites, manage services, update configuration and more. Get started with our package of over 20 free PowerShell scripts for SharePoint. Our free scripts pack includes these 5 popular scripts, plus many more -
  • IMPORT-SPSITE - Imports a site from a backup file
  • ADD-SPUSER - Adds a new user to a group in SharePoint
  • REMOVE-SPSITE - Removes a site from the site collection
  • SET-SPITEM - Modifies a list item
  • DISPLAY-SPLIST - Displays all lists
Download free tool now!
Get fast, easy and reliable backups with SharePoint backup
SharePoint backup provides fast, full-farm backup and restore, powerful search capabilities and easy item-level recovery, plus tools to schedule, manage and monitor backups farm-wide.
SharePoint backup 
Download now to get fast, easy, and reliable backups with these features:
Lightning-Fast Backups
Full-Farm Protection
Real-Time Status Alerts
Self-Service Document Recovery
Download a free trial now!

Friday, June 15, 2012

Restore a Web application in SharePoint 2010 using Windows PowerShell

  1. Open SharePoint 2010 Management Shell.
  2. At the Windows PowerShell command prompt, type the following command:

Restore-SPFarm -Directory <BackupFolderName> -RestoreMethod Overwrite -Item  <WebApplicationName> [-BackupId <GUID>] [-Verbose]

3.      If you do not specify the value of the BackupID parameter, the most recent backup will be used.
4.      You cannot restore a Web application by using a configuration-only backup.
5.      You can view the backups for the farm by typing the following

Get-SPBackupHistory -Directory <BackupFolderName> -ShowBackup

Friday, June 8, 2012

How to restore content database using PowerShell in SharePoint 2010 ?



  1. Open SharePoint 2010 Management Shell.
  2. At the Windows PowerShell command prompt (that is, PS C:\>), type the following command, and then press ENTER:

Restore-SPFarm -Directory <Backup folder name> -RestoreMethod Overwrite -Item <Content database name> [-BackupId <GUID>] [-Verbose]

3.      If you do not use the BackupId parameter, the most recent backup will be used. To view a list of the backups, including their Backup IDs, type the following command, and then press ENTER:

Get-SPBackupHistory -Directory <Backup folder>