I have been meaning to publish this PowerShell script for a few months but finally got around to it today. The PowerShell script creates a project from a template then updates the Enterprise Project Type (EPT). I did write a post over a year ago on how to create a project using PowerShell but this didn’t update the EPT:
The issue is that even if your Project Plan Template is associated to an EPT in Project Server, the project created from the CreateProjectFromTemplate method is associated to the default EPT regardless. This script will prompt for the project name, the project plan template name and the EPT name. It will create the project then update the project to associate it to the desired EPT. The script can be downloaded from the script gallery below:
http://gallery.technet.microsoft.com/scriptcenter/Create-Server-2010-2013-19bd3cc7
Once downloaded, the script will need to be updated with the correct PWA URL, the lines that need updating are 9 and 23. These can bee seen below:
Update the http://vm753/pwa part of the URL for your PWA URL.
A walkthrough using the script is below.
Open Windows PowerShell and navigate to the PowerShell file, in this example it is on the desktop:
Press Enter and complete the details:
The new Project will be called “CPS Test Project by Paul Mather”, it will use the “PMTemp1” template and then associate the new project to the “PM TEST” EPT.
The project is created as you can see in the Project Center:
It is also associated to the specified EPT:
The default EPT on this PWA instance is “Enterprise Project”:
When using the CreateProjectFromTemplate method only, this new project would have been associated to the Enterprise Project EPT as this is the default EPT.
This is just an example of what can be done, many improvements could be made, certainly around error handling but it provides a working example for you to build on.
