1: Add-PsSnapin Microsoft.SharePoint.PowerShell
2:
3: #this script was designed to deploy the project web access environment to a explicit managed path off the root of the web application, and will create the managed path for you.
4: #Part 1 of this script will need to be run on each application server, Part 2 will need to be run only once
5: $webAppUrl = "http://spdemo/"
6: $managedPath = "pwa"
7: $contentDatabaseName = "SP_Content_PWA" #as per technet, we should aim to use a dedicated content database for our project web access instance
8:
9: #---Begin Part 1 that must be run on every application server---#
10: #Copy the files from the doc lib template to the Project Server doc lib feature as per: http://technet.microsoft.com/en-us/library/ee662109.aspx
11: Copy-Item -LiteralPath "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\Template\Features\DocumentLibrary\DocLib\FileDlg.htm" -Destination "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\Template\Features\pwsdoclibs\pwsdoclib\FileDlg.htm"
12: Copy-Item -LiteralPath "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\Template\Features\DocumentLibrary\DocLib\EditDlg.htm" -Destination "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\Template\Features\pwsdoclibs\pwsdoclib\EditDlg.htm"
13:
14: #Make sure our service instance is up and running
15: $PSServiceInstance = Get-SPServiceInstance | Where {$_.TypeName -eq "Project Application Service"}
16: Write-Host "Found PS Service Instance GUID " $PSServiceInstance.ID
17: if($PSServiceInstance.Status -ne "Online")
18: {
19: ServerManagertart-SPServiceInstance $PSServiceInstance.ID
20: }
21: else
22: {
23: Write-Host "Not starting the Project Server instance since it's already started"
24: }
25: #--- End Part 1 ---#
26:
27:
28: #--- Begin Part 2 that must be run only once on the farm ---#
29: #build our service applicaiton and proxy
30: $DefaultServiceAppPool = Get-SPServiceApplicationPool -Identity "SharePoint Web Services Default"
31: $PSServiceApplicaiton = New-SPProjectServiceApplication -Name "Project Server Service Application" -ApplicationPool $DefaultServiceAppPool
32: $PSServiceApplicationProxy = New-SPProjectServiceApplicationProxy -Name "Project Server Service Application Proxy" -ServiceApplication $PSServiceApplicaiton
33:
34: #Create the Project Web Application content database
35: $PWAContentDB = New-SPContentDatabase -Name "SP_Content_PWA" -WebApplication $webAppUrl -MaxSiteCount 1 -WarningSiteCount 0
36:
37: #Prep the web application for our PWA instance
38: New-SPManagedPath -RelativeURL $managedPath -WebApplication $webAppUrl -Explicit
39:
40: #Create the PWA instance
41: New-SPProjectWebInstance -AdminAccount "contoso\yourlogon" -ArchiveDbname "Project_ArchiveDB" -DraftDbname "Project_DraftDB" -PrimaryDbserver "lousql2k8r2" -PublishedDbname "Project_Published" -ReportingDbname "Project_Reporting" -ReportingDbserver "lousql2k8r2" -Url "$webAppUrl$managedPath"
42:
43: $webInstance = Get-SPProjectWebInstance -Url "$webAppUrl$managedPath"
44: while($webInstance.ProvisioningStatus -ne "Provisioned")
45: {
46: Write-Host "Still waiting" $webInstance.Status
47: $webInstance = Get-SPProjectWebInstance -Url "$webAppUrl$managedPath"
48: }
49:
50: #Provision any additional administrators here
51: New-SPProjectSiteAdministrator -AdminAccount "contoso\johndoe1" -Url "$webAppUrl$managedPath"
52: New-SPProjectSiteAdministrator -AdminAccount "contoso\johndoe2" -Url "$webAppUrl$managedPath"
53:
54: #You will still need to set the workflow account detailed at http://technet.microsoft.com/en-us/library/ee662105.aspx
55:
56: #After configuring the workflow, you will then need to configure the reporting configuration as well
57: #http://technet.microsoft.com/en-us/library/ee662106.aspx
58:
59: #--- End Part 2 --- #