Microsoft Project Server 2010 and PowerShell

In case you have not heard SharePoint 2010 and Project Server 2010 will support PowerShell and hence will ship with a library of already about 650 commands. Please find below a few examples I wrote trying to automate Project Service Application creation.

One useful commands to get started:  Get-Help *project* (lists all cmdlet that contains the word ‘project’).


Check out this recently Project Server 2010 PowerShell Help file for more information:

As usual we will release Project Server 2010 PowerShell documentations by RTM on TechNet. One of the great thing about PowerShell is that you can easily create your own commands (think of a utility that issues PSI calls for instance…), stay tune for more samples MSDN, in the meantime experiment the power of PowerShell :)

 $projectapppool = "ProjectServer-AppPool"
$projectserviceapp = "ContosoProjectServiceApplication"
$pwaname = "PWA"
$projectwebappname = "Contoso Project Server Site"
$projectwebappport = 82
$projectwebappurl = ""
$projectwebcontentdb = "ProjectServer"+$projectwebappport+"_Content"
$adminaccount = "contoso\administrator"
$databaseserver = "DEMO2010A"
# Create Application Pool
New-SPServiceApplicationPool  -Name $projectapppool -Account $adminaccount

# Create Project Service Application
New-SPProjectServiceApplication -ApplicationPool $projectapppool -Name $projectserviceapp

# Create Project Service Application Proxy
New-SPProjectServiceApplicationProxy -Name ContosoProjectServiceApplicationProxy -ServiceApplication $projectserviceapp

# Create Project Server Web Application with its own Content Database
New-SPWebApplication -Name $projectwebappname -Port $projectwebappport -URL $projectwebappurl -ApplicationPool $projectapppool -ApplicationPoolAccount $adminaccount -DatabaseName $projectwebcontentdb

# Create New Project Server Site Collection
# Get-SPWebTemplate
New-SPSite -Url ($projectwebappurl+ ":" +$projectwebappport) -OwnerAlias $adminaccount -ContentDatabase $projectwebcontentdb -Template PWS#0

# Provision PWA Instance
New-SPProjectWebInstance -AdminAccount $adminaccount -ArchiveDbname ($pwaname +"_Archive") -DraftDbname ($pwaname +"_Draft") -PrimaryDbserver $databaseserver -PublishedDbname ($pwaname +"_Published") -ReportingDbname ($pwaname +"_Reporting") -ReportingDbserver $databaseserver -Url ($projectwebappurl + ":" + $projectwebappport + "/" + $pwaname) -Lcid 1033

Great PowerShell resources: