RSS

Category Archives: PowerShell

Step by Step: Install, configure, and Deploy Project Server 2013 – Part 5: Deploy Project Web App with a new site collection – Project Server 2013


This is the Fifth and Final part for Step by Step: Install, configure, and Deploy Project Server 2013 Article,

Article Content’s Index:

  1. Part 1: Overview and Prepare for a deployment of Project Server 2013
  2. Part 2: Install and Configure Project Server 2013
  3. Part 3: Configure Project Server 2013 Application Service
  4. Part 4: Deploy Project Web App with a new site collection – Project Server 2013
  5. Part 5: Deploy Project Web App in an existing site collection – Project Server 2013

Deploy Project Web App in an existing site collection – Project Server 2013

For this post I create a Web Application with Top-Level Site collection. In Top-Level site, there is no link for PWA Setting in Site Action Menu. We want to enable PWA for this site collection

image

Deploying an instance of Project Web App to an existing site collection consists of the following:

  1. Enable the Project Web App site collection features
  2. Create a Project Web App site in an existing site collection

These steps will be created using PowerShell Script.

Read the rest of this entry »

 

Tags: , , , , , , ,

Export and/or Import All Farm Solutions in SharePoint 2010/2013 Farm using PowerShell


Sometimes you may need to export all SharePoint 2010/2013 farm solutions as a backup process or to deploy them from staging environment to production environment.

Export Farm Solutions

  1. Create a backup folder on “C” and give it a meaningful name like “SP2010 Farm Solutions Backup”.image
  2. Open SharePoint 2010 Management Shell
     image
  3. Change directory or navigate to backup folder
     image
  4. Enter the following Script to extract all farm solution to current location directory

    (Get-SPFarm).Solutions | ForEach-Object{$var = (Get-Location).Path + “\” + $_.Name; $_.SolutionFile.SaveAs($var)}
     


    image

    image

  5. Go and open the target folder to see all exported solutions Smile

Import Farm Solutions

After copy the folder that contains exported solution on production or target farm server.

  1. Open SharePoint 2010 Management Shell
  2. Change directory or navigate to folder that contains all solutions to be deployed
  3. Enter the following Script to extract all farm solution to current location directoryGet-ChildItem | ForEach-Object{Add-SPSolution -LiteralPath $_.Fullname}

     image
  4. So all solutions are added to the target farm.

For more information about adding and deploying SP2010 Farm solution, please to open and read Adding and Deploying SharePoint 2010 .WSP Solutions

Same scripts can be used for SharePoint 2013 Farm Solution

I Hope this useful for you,

Thanks.

 

Tags: , , , , , , , , ,

From The Field: Move a Site Collection to New Content DB with New Managed Path


Many of clients have multiple site collection stored in the same content DB of the web application. And in some day, they will discover that one of site collection contents is growing so fast, and they decide to have a dedicated Content DB for this Site Sollection. Also they may want to change the Managed Path (url) of site, i.e.: from “http://hostheader/sites/sitename” to “http://hostheader/sitename”.

In this article, I will explain how I did these requirements in the following scenario:

1. I have a web application with url (http://sps:1), and all site collection under this web application shared the same Content DB (Name: WSS_SP01_Content_01)

2. I have 2 Site Collection (Host Header Root Site and HR Site):

  • Main portal Site Collection under Host Header Root Managed Path (/)


  • HR portal site collection under the managed path (/sites/hr/)


  • I want to move the “HR” site to a new Content DB called(WSS_SP01_HR_Content_01)
  • I want to change the url from (/sites/hr/) to (/hr/).

The Steps are (using PowerShell):

1. Open PowerShell – SharePoint 2010 Management Shell

2. Create Explicit Managed Path for target Web Application, and call it “hr

  • Enter the following line in PowerShell:
    New-SPManagedPath -RelativeURL “hr” -WebApplicationhttp://sps:1” –Explicit
  • The PowerShell Results are:

  • Check it from Central Administration > Manage Web Applications > Managed Path:

3. Create a new Content DB called “WSS_SP01_HR_Content_01”

  • Enter the following line in PowerShell
    New-SPContentDatabase -name “WSS_SP01_HR_Content_01” -WebApplicationhttp://sps:1” -MaxSiteCount 1 -WarningSiteCount 0
  • Max Site Count = 1, to make sure No farther Site Collection can be added to this Content DB
  • The PowerShell Results are:

  • Check it from Central Administration > Manage Web Applications > Managed Content Databases:

4. Back up Site Collection “/sites/hr” to prepare moving it

  • Enter the following line in PowerShell::
    Backup-SPSitehttp://sps:1/sites/hr” -Path “C:\HR_TempSC.bak” –force
  • Check the file on “C” Drive

5. Removing the Site Collection from old managed path

  • Enter the following line in PowerShell::
    Remove-SPSite -Identityhttp://sps:1/sites/hr” -GradualDelete -Confirm:$false
  • Check the current number of Site Collection of Main Content DB (WSS_SP01_Content_01) , It should be 2 ( minus the HR Site Collection)

6. Restoring Site Collection to new Managed Path “/hr

  • Enter the following line in PowerShell::
    Restore-SPSitehttp://sps:1/hr” -Path “C:\HR_TempSC.bak” -DatabaseServer “SPS” -DatabaseName “WSS_SP01_HR_Content_01” -GradualDelete -Force -Confirm:$false
  • Check the current number of Site Collection of Main Content DB (WSS_SP01_HR_Content_01), It should be “1”

7. Remove the backup files from the backup directory

  • Enter the following line in PowerShell:
    Remove-Item “C:\HR_TempSC.bak”

8. Check the old url of HR, It should be not exists


9. Check the new HR Site Collection url “http://sps:1/hr” :

10. Check the Site Collection Properties, Central Admin > Application Management > View all site collections

Conclusion

I move and change the managed path of the site collection as simple as described before using PowerShell script. It is easy, clear, and save my time. and the following is the list of scripts i used in article:

  1. New-SPManagedPath -RelativeURL “hr” -WebApplicationhttp://sps:1” -Explicit
  2. New-SPContentDatabase -name “WSS_SP01_HR_Content_01” -WebApplicationhttp://sps:1” –MaxSiteCount 1 -WarningSiteCount 0
  3. Backup-SPSitehttp://sps:1/sites/hr” -Path “c:\HR_TempSC.bak” -force
  4. Remove-SPSite -Identityhttp://sps:1/sites/hr” -GradualDelete -Confirm:$false
  5. Restore-SPSitehttp://sps:1/hr” -Path “C:\HR_TempSC.bak” -DatabaseServer “SPS” -DatabaseName “WSS_SP01_HR_Content_01” -GradualDelete -Force -Confirm:$false
  6. Remove-Item “c:\HR_TempSC.bak”

For farther information about Windows PowerShell for SharePoint 2010, you can visit: Windows PowerShell for SharePoint Foundation 2010 reference

I Hope this useful for you,

Thanks.

 

Tags: , , ,