Install Project Server 2013 with PowerShell

Last week, I was working on my demo environment to be used for some future presentations. When I was looking around on the great MSDN world to get some best practices related to a Project Server 2013 Preview installation, I came across a link called: “Install Project Server 2013 with Powershell” by Jime Cox. That sounds really cool, although is easy to memorize the steps to install Project Server through Central Admin after you have done it a few times, it’s more fun to automate this process and adjust it to your own needs. And that’s where the PowerShell part is rocking!

In this post, I want to provide my experience about the installation of Project Server 2013 Preview using the PowerShell script.

First thing you have to do is to perform the installation of Project Server 2013 on a SharePoint 2013 server. You have to perform this step on each application server of your SharePoint farm. You can download Project Server 2013 preview from this link. Once the download has completed, run the setup. First thing you have to do is provide your key (which is available from the link):

Next step is to click ‘Install Now’. This will start the actual installation.

When the installation is ready, it will ask to ‘Run the SharePoint Products Configuration Wizard’. Leave the check box active, and click ‘Close‘.

On the SharePoint Products Configuration Wizard, follow the steps of the wizard, and use the default settings:

Connect to your existing SharePoint Farm, and continue the configuration:

Ok, now that we have installed Project Server 2013. It’s time to ‘activate’ and ‘configure’ it. We will use PowerShell to help us with this task. You can download the script from this link. This is how the script is constructed:

Personally, I really love PowerShell when you execute it with the PowerShell ISE (Integrated Scripting Environment). This way, you can debug and re-factor your scripts very quickly. First part of the script is required if you run the script directly from the PowerShell ISE. What it does is loading the required SharePoint functions into your PowerShell session. If you run the script directly from the SharePoint PowerShell command line tool, you don’t need to do this.

NOTE: You need to execute the scripts with your Farm Admin account. This way, you will never get permission errors!

$ver = $host | select version  
if ($ver.Version.Major -gt 1) {$Host.Runspace.ThreadOptions = "ReuseThread"}  
Add-PsSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

Next part is the definition of the variables. They contain the URL’s, accounts, your SQL server,..

# Set your variables 
$HostHeader = "sharepoint.local.ad"  
$WebAppName = "Project Server 2013 Web App" 
$ProjectAppPool = "ProjectServer2013AppPool" 
$SvcAppName = "Project Server 2013 Service App" 
$PwaName = "PWA" 
$WebAppPort = 80 
$WebAppURL = "http://sharepoint.local.ad/" # I am using host header and DNS 
$PwaWeb = "http://sharepoint.local.ad/PWA" 
$PWAContentdb = "Project_Server_Content_2013" 
$ProjectDataDb = "Project_Server_Data_2013" 
$FarmAdmin = "local\spadmin" 
$PWAAdmin = "local\pwaadmin" 
$SqlServer = "slqerver"

Next part checks of the SharePoint 2013 timer service is running. If not, it starts this service

# Check to make sure th SP Timer is running 
$spTimerService = Get-Service "SPTimerV4" 
    if($spTimerService.Status -ne "Running") { 
        Write-Host -ForegroundColor Yellow "SharePoint 2013 Timer Service is not running. Atempting to start the timer." 
        Start-Service "SPTimerV4" 
        $spTimerService = Get-Service "SPTimerV4" 

        while($spTimerService.Status -ne "Running") { 
            Start-Sleep -Seconds 10 
            Start-Service "SPTimerV4" 
            $spTimerService = Get-Service "SPTimerV4" 
        } 

        Write-Host -ForegroundColor Green "SharePoint 2013 Timer Service is running." 
    } 
    else { 
        Write-Host -ForegroundColor Green "SharePoint 2013 Timer Service is running." 
    }

In this next part, the Project Server Application Service is checked. If you did not install Project Server on your SharePoint Application server(s), this should result in an error. If the Service Instance is not online yet, the script will try to start it.

#Make sure Project Server service instance is up and running, if not start it   
$PSServiceInstance = Get-SPServiceInstance | Where {$_.TypeName -eq "Project Server Application Service"}   
Write-Host "`nHere are all PS Service Instances across farm"  
$PSServiceInstance   
$PsServiceInstanceGUID = $PSServiceInstance.Id # note the status at this point 
    if($PSServiceInstance.Status -ne "Online")   
    {   
        start-SPServiceInstance $PsServiceInstanceGUID   
     }   
     else   
     {   
         Write-Host "Project Server instance already started"   
     } 
sleep 2 
Write-host -ForegroundColor Green "Status: " $PSServiceInstance.Status

Now the fun part. In this step, we will create an Application Pool and a Web App. The FarmAdmin account is used as Application Pool Account. The second part of this piece will create a web application, using the application pool we’ve just create. It will also create a Content Database.

# Create Application Pool and Web App 
# Note: New in 2013 is -AuthenticationMethod parameter,  I set to  NTLM,  
# to keep it simple for now, we will have to change this script to Claims later. 
New-SPServiceApplicationPool  -Name $ProjectAppPool -Account (Get-SPManagedAccount $FarmAdmin) 
New-SPWebApplication -Name $WebAppName -AuthenticationMethod NTLM  -Port $WebAppPort -URL $WebAppURL -ApplicationPool $ProjectAppPool -ApplicationPoolAccount (Get-SPManagedAccount $FarmAdmin) -DatabaseName $PWAContentdb 
sleep 2

Now we will create the Project Service Application. It will use the Project Application Pool from the last step.

# Create Project Service Application and Proxy 
New-SPProjectServiceApplication –Name $SvcAppName –ApplicationPool $ProjectAppPool –Proxy

Next step is to create the actual Project Server Database. Note that in Project Server 2013, there is only one database, related to Project Server 2010 who has multiple databases.

# This is new in 2013. Create a Project database, not 4 databases, just one. 
New-SPProjectDatabase -Name $ProjectDataDb -ServiceApplication $SvcAppName -DatabaseServer $SqlServer -Tag "ProjectWebApp1DB"

In this step, we will create a new Site Collection for PWA, and enable the Project Web App site collection features

New-SPSite -Url $WebAppURL -OwnerAlias $FarmAdmin -ContentDatabase $PWAContentdb #-Template Leave blank, it will be set later on 
$web=Get-SPWeb $WebAppURL 
$web.Properties["PWA_TAG"]="ProjectWebApp1DB" 
$web.Properties.Update() 
Enable-SPFeature pwasite -URL $WebAppURL

To create a Project Web App in an existing site collection, you run the  Windows PowerShell cmdlet to create the web and then run the Upgrade-SPProjectWebInstance to perform post-provisioning actions, including creating a Business Intelligence Center.

New-SPweb -URL $PwaWeb -Template pwa#0 
sleep 3 
Upgrade-SPProjectWebInstance -Identity $PwaWeb  #-Confirm:$False

When you executed all those steps, you should have your PWA up and running.

Have fun!

Written by
Alexander Vanwynsberghe
Join the discussion

7 comments

Menu

Alexander Vanwynsberghe

Belgium-based entrepreneur. Into technology, innovation and a bit of cycling and running too. Evangelist for everything related to smart-tech.