#ProjectServer #PS2010 / #PS2013 bulk #Project site creation using #PowerShell 3.0 or later #SP2013 #SP2010

March 5, 2014 at 11:18 am | Posted in Add-on, Administration, Configuration, Customisation, Functionality, PowerShell, PSI | 4 Comments
Tags: , , , , , , , , ,

I recently had to bulk delete and then bulk create project sites for a client. Rather than engaging one of our devs I wrote a PowerShell script to do this. This does need PowerShell 3.0 or later to work. This post covers the bulk create script as this is generic, the bulk delete was specific to the client so I haven’t published that. The script can be downloaded from the script galley below:

http://gallery.technet.microsoft.com/scriptcenter/Bulk-create-Server-Sites-784f7b29

The web service proxy URLs will need to be updated for your PWA instance, replace the http://vm753/pwa with the correct URL.

The script can be seen running and creating sites below:

From the PowerShell ISE:

image

From PowerShell:

image

Project Sites are created using the correct site template that is associated to the EPT.

If all projects have a site associated, the following is returned:

image

Test this on a test / dev farm before running a live production farm.

Create a #ProjectServer #PS2010 #PS2013 project from a template and update the EPT #SP2013 #SP2010 #PowerShell

August 30, 2013 at 11:24 am | Posted in Add-on, Administration, Configuration, Customisation, Functionality, PowerShell, PSI | 1 Comment
Tags: , , , , , , , , ,

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:

https://pwmather.wordpress.com/2012/01/17/create-and-publish-a-project-in-projectserver-via-powershell-ps2010-msproject-sp2010/

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:

image

image

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:

image

Press Enter and complete the details:

image

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.

image

The project is created as you can see in the Project Center:

image

It is also associated to the specified EPT:

image

The default EPT on this PWA instance is “Enterprise Project”:

image

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. Smile

#PowerShell scripts for #ProjectServer #PS2013 #SP2013 #PPM

August 29, 2013 at 9:03 am | Posted in Administration, Configuration, Customisation, Functionality, Information, PowerShell, PSI | 1 Comment
Tags: , , , , , ,

I haven’t posted for a while due to work commitments and just generally being too busy – I am hoping this will change after the summer!

Anyway, just a quick post today to let you know that I have tested some of the key PowerShell scripts I wrote for Project Server 2010 on Project Server 2013. These also work for Project Server 2013. I have since updated the script gallery and associated blogs posts for these scripts listed below:

Publish All Projects:
http://gallery.technet.microsoft.com/scriptcenter/Server-2010-Publish-all-45ba385b

Publish Specified Projects:
http://gallery.technet.microsoft.com/scriptcenter/Server-2010-Publish-537857d8

High-level Audit example:
http://gallery.technet.microsoft.com/scriptcenter/Server-2010-High-level-e9c6ad09

Updating Project Server Lookup Tables:
http://gallery.technet.microsoft.com/scriptcenter/Update-Server-Lookup-table-bb1ae14f

My other scripts are available for download here:
http://gallery.technet.microsoft.com/scriptcenter/site/search?f%5B0%5D.Type=User&f%5B0%5D.Value=PWMather

Look out for more scripts coming soon.

Enjoy Smile

Publish specified Projects in #ProjectServer using #PowerShell #MSProject #PS2010 #SP2010 #PS2013

October 22, 2012 at 12:54 pm | Posted in Administration, Configuration, Customisation, Functionality, PowerShell, PSI | 5 Comments
Tags: , , , , ,

There have been several requests for publishing projects listed in a text file, this follows on from my post / publish all projects script found below:

https://pwmather.wordpress.com/2012/05/31/updated-publish-all-projects-in-projectserver-using-powershell-msproject-ps2010-sp2010/

http://gallery.technet.microsoft.com/scriptcenter/Server-2010-Publish-all-45ba385b

****Update – this also works for Project Server 2013****

This script allows you to specify a list of projects in a text, then only those projects will be sent for publishing. For the purpose of this post I have a text file called projectstobepub.txt that contains a list of my test projects to be published:

image

The PowerShell script will need to be updated to reference the text file containing the list of projects that you wish to publish and also update the Project Server PWA URL. Comments have been added in the screen shot below to show what lines need to to be updated:

image

The script has my test PWA instance URL as highlighted below:

New-WebServiceProxy -uri “http://vm353/pwatest/_vti_bin/PSI/Project.asmx?wsdl” –useDefaultCredential

The strikethrough text will need to be updated with the correct URL for your environment.

The script can be downloaded from the Script Center following the link below:

http://gallery.technet.microsoft.com/scriptcenter/Server-2010-Publish-537857d8

Once the script has been executed, the projects listed in the text file will be sent for publishing.

The script can either be executed on demand or set on a schedule using Windows Tasks Scheduler. Execute the script with an account that has access to the projects listed in the text file.

Update #ProjectServer lookup tables using #PowerShell #PS2010 #SP2010 #MSProject #PS2013

August 29, 2012 at 10:30 am | Posted in Administration, Configuration, Customisation, Functionality, PowerShell, PSI | 4 Comments
Tags: , , , ,

I recently wrote a PowerShell script that updates a Project Server lookup table with values from a text file. The script is available to download, I have uploaded it to the Microsoft Script Center below:

http://gallery.technet.microsoft.com/scriptcenter/Update-Server-Lookup-table-bb1ae14f

****Update – this also works for Project Server 2013****

This post will detail what needs to be updated in the script, the text file and a walkthrough of using the script.

Firstly lets take a look at the text file containing the values that I want to add to my lookup table. Worthing noting is that it can either be an empty lookup table or a lookup table that already contains values. The values I am going to add can be see below:

image

This script does assume that the lookup table values are all level 1.

As mentioned there are variables / lines in the script that will need to be updated, these can be seen below:

  • $values = Get-Content “C:\Lookupvaluestoadd.txt”  – This line will need to be updated to reference the filename and path for the text file that contains the lookup table values.
  • $lookupTablename = “Test Lookup Table” – This variable will need to be updated to reference the lookup table you wish to update
  • $svcPSProxy = New-WebServiceProxy -uri “http://vm353/pwa/_vti_bin/PSI/LookupTable.asmx?wsdl” – This line will need to be updated to reference your Project Server PWA URL, replace http://vm353/pwa with your PWA URL

The following methods will need to be updated to reference to correct local ID, the script currently uses 1033:

  • ReadLookupTables
  • ReadLookupTablesbyUids (used twice)
  • UpdateLookupTables

Now that we have the lookup table values ready in the text file and the lookup table exists, in this example the lookup table is call “Test Lookup Table”, we are ready to execute the script. Also make sure the lookup table is checked in.

As you can see below, currently the “Test Lookup Table” is empty:

image

After closing the lookup table (the lookup table needs to be checked in), we will execute the PowerShell script to insert the values from the text file. Open Windows PowerShell with a Project Server administrator account and navigate to the location of the script, in this case it is on the desktop:

image

Press enter to execute:

image

The script states that everything was successful, now see the lookup table:

image

I have created some other PowerShell scripts working with lookup tables, I will upload these in the next week or so.

As always, this script is provided as is with no warranties etc. use at your own risk and test on a test environment before using on a production environment.

Updated Publish all Projects in #ProjectServer using #PowerShell #MSProject #PS2010 #SP2010 #PS2013

May 31, 2012 at 11:48 am | Posted in Administration, Functionality, PowerShell, PSI | 4 Comments
Tags: , , , ,

I have been meaning to update the publish all script for a while now but only just got a chance to post the updated script here and also published it to the script center.

The publish all script from my earlier blog post works fine until you have a project that exists in the Archive database and not the Draft database (working store). An error will appear in the Project Server queue similar to this:

ProjectPublish.VerifyWorkingProjectExistsMessage

As the original script uses the ReadProjectList method, it is not possible to specify the data store. The new script uses the ReadProjectStatus method as this allows you to specify the data store.

The updated line can bee seen below, to access the full script please visit the script center:

$ProjectList = $svcPSProxy.ReadProjectStatus(“$EPMTYGUID”,”WorkingStore”,””, “0”).Project | format-table proj_uid -hidetableheaders | out-string –stream

Full script available below:

http://gallery.technet.microsoft.com/scriptcenter/Server-2010-Publish-all-45ba385b

****Update – this also works for Project Server 2013****

The script will need to be updated for the correct PWA URL as shown below. The script has my test PWA instance URL as highlighted below:

New-WebServiceProxy -uri “http://vm353/pwatest/_vti_bin/PSI/Project.asmx?wsdl” –useDefaultCredential

The strikethrough text will need to be updated with the correct URL for your environment.

This script can be run on demand or scheduled. To schedule this to run on a nightly / weekly basis use the Windows Task Scheduler. Create a new batch file to execute the PowerShell script from the scheduled task. An example of the command need in the batch file can be seen below:

“%SYSTEMROOT%\system32\windowspowershell\v1.0\powershell.exe” -command “& ‘C:\PublishAllProjects.ps1′”

Set the scheduled task to run under the PWA administrator account to publish all projects.

#ProjectServer 2013 / 2010 / 2007 high-level Audit Export via #PowerShell #MSProject #PS2010 #EPM

March 5, 2012 at 6:15 pm | Posted in Administration, PSI, Add-on, Reporting, PowerShell | 1 Comment
Tags: , , , , , , ,

Quite often there is a request for audit information from Project Server but unfortunately there is nothing available out of the box. This post covers a very high-level solution to this using the Project Server PSI and PowerShell.

Most actions in Project Server are processed via the Project Server queue, one simple way to get high-level audit information is to extract the queue information. The following PowerShell script uses the ReadAllJobStatusSimple method from the Queue System web service to export yesterdays processed jobs into a txt file with yesterday date appended to the filename:

The script can be downloaded from the script center:

http://gallery.technet.microsoft.com/scriptcenter/Server-2010-High-level-e9c6ad09

$Today = Get-Date
$Yesterday = $Today.AddDays(-1).ToString(“yyyy-MM-d”)
$Filename = “C:\PSAuditExport\QueueExport-”
$filetype = “.txt”
$svcPSProxy = New-WebServiceProxy -uri “http://vm353/pwa/_vti_bin/PSI/QueueSystem.asmx?wsdl” -useDefaultCredential
$svcPSProxy.ReadAllJobStatusSimple(“$Yesterday 00:00:01”, “$Yesterday 23:59:59”, “200”, “0”, “QueueCompletedTime” ,”Ascending”).Status | Export-CSV $Filename$Yesterday$filetype -Delimiter “|”

Update the filename variable and PWA URL, save the script and execute using a batch file that is scheduled via the Windows task scheduler sometime after midnight to get yesterdays jobs. An example command needed in the batch file is below:

“%SYSTEMROOT%\system32\windowspowershell\v1.0\powershell.exe” -command “& ‘C:\QueuejobstatusAudit.ps1′”

Once executed this will export all of the jobs for that day to a text file in the specified location, in this case C:\PSAuditExport as shown below:

image

An example export looks like this:

image

The export could then be used for auditing purposes. For example, to see who saved or published a particular project you could search for the Project GUID in the export file and find the GUID’s of the Resources / users that saved or published that project on that particular day.

This is a very simple solution that I put together for the purpose of this post, this could be taken a lot further and made into a production solution.

Publish all Projects in #ProjectServer using #PowerShell #MSProject #PS2010 #SP2010

January 23, 2012 at 5:51 pm | Posted in Add-on, Administration, Configuration, Functionality, PowerShell, PSI | 12 Comments
Tags: , ,

A frequent request from Project Server Administrators is how can I publish all projects on the server to ensure that the reports are current. This is where PowerShell comes in very handy again. Below is the PowerShell script that will publish all project plans in the server.

$svcPSProxy = New-WebServiceProxy -uri "http://vm353/pwatest/_vti_bin/PSI/Project.asmx?wsdl" -useDefaultCredential
$ProjectList = $svcPSProxy.ReadProjectList().Project | Where-Object { $_.PROJ_TYPE -ne 1 } | format-table proj_uid -hidetableheaders | out-string -stream
foreach ($projectUid in $projectList)
{
    if ($projectUid -ne "")
    {
$G = [System.Guid]::NewGuid()
$svcPSProxy.QueuePublish("$G", $projectUid, "true","")}}

This script can be run on demand or scheduled. To schedule this to run on a nightly / weekly basis use the Windows Task Scheduler. Create a new batch file to execute the PowerShell script from the scheduled task. An example of the command need in the batch file can be seen below:

"%SYSTEMROOT%\system32\windowspowershell\v1.0\powershell.exe" -command "& ‘C:\PublishAllProjects.ps1’"

Set the scheduled task to run under the PWA administrator account.

Create and publish a Project in #ProjectServer via #PowerShell #PS2010 #MSProject #SP2010

January 17, 2012 at 7:53 pm | Posted in Configuration, Customisation, Functionality, PowerShell, PSI | 6 Comments
Tags: , , ,

Following on from a recent post on Project Server PSI PowerShell scripts, I thought of a nice slightly more advanced example. The script below will create a new project using the specified project template.

$ProjName = Read-Host -Prompt "Enter the Name of the Project"
Write-host "The Project is called $ProjName"
$svcPSProxy = New-WebServiceProxy -uri "http://vm353/pwatest/_vti_bin/PSI/Project.asmx?wsdl" -useDefaultCredential
$NewProjGUID = $svcPSProxy.CreateProjectFromTemplate("01dbd28a-fcb6-4ccf-bb42-645982f48cf3", $ProjName)
$G = [System.Guid]::NewGuid()
$svcPSProxy = New-WebServiceProxy -uri "http://vm353/pwatest/_vti_bin/PSI/Project.asmx?wsdl" -useDefaultCredential
$svcPSProxy.QueuePublish("$G", $NewProjGUID, "true","")
Write-host "********* $ProjName has now been created *********"

Below is a walkthrough:

I have the script saved as CreateProject.ps1 on my desktop:

image

Hit Enter to execute the script:

image

You are prompted for the Project name, give the new Project a name and hit Enter:

image

A message will then appear with the chosen Project Name:

image

The script will then create a new project using the CreateProjectFromTemplate method with the project template and project name specified. In the next step it generates a new GUID ready to be used for the project publish job GUID. The script will then use the QueuePublish method and pass in the new GUID for the publish job, the GUID of the new project, specifies a full publish and creates a project site:

image

Now you can see the project in the Project Centre:

image

And the Project Site:

image

A basic example of creating a project with a 5 or 6 line PowerShell script!

#ProjectServer 2010 PSI #PowerShell examples #PS2010 #MSProject #SP2010

January 12, 2012 at 10:03 pm | Posted in Customisation, Functionality, PowerShell, PSI | 9 Comments
Tags: , , ,

Following from a post I wrote mid last year on Project Server data export using the PSI and PowerShell I thought I would create a new post to show further simple examples of getting Project data via the PSI using PowerShell (no coding!).

Firstly I will just explain each part of a simple script using the example below:

The first line adds the PWA instance URL to the pwaUrl variable:

$pwaUrl = “http://vm353/pwatest”

The second line concatenates the PWA URL (stored in the pwaUrl variable) and the web service URL and adds both of these to the svcPSUrl variable:

$svcPSUrl = $pwaUrl + "/_vti_bin/PSI/Project.asmx?wsdl"

The next line calls the Get-Credential cmdlet to specify a user name and password and adds the credentials to the c variable:

$c = Get-Credential

The fourth line creates the new web service proxy with the PWA web service URL and the credentials previously entered and adds these details to the svcPSProxy variable:

$svcPSProxy = New-WebServiceProxy -uri $svcPSUrl -credential $c

The last line is used to access and query the web service, the web service details are stored in the svcPSProxy variable, then the ReadProjectList method is called to access the Project details specified in the select statement using the Project property of the ProjectDataSet class:

$svcPSProxy.ReadProjectList().Project | Select Proj_name, Proj_UID, Proj_Type

A shorter version of the same query can be seen below:

$svcPSProxy = New-WebServiceProxy -uri "http://vm353/pwatest/_vti_bin/PSI/Project.asmx?wsdl" -useDefaultCredential
$svcPSProxy.ReadProjectList().Project | Select Proj_name, Proj_UID, Proj_Type

The script above does exactly the same but is structured differently. The PWA web service URL is added directly to the New-WebServiceProxy object and this query will pass through the logged on users credentials rather than having to enter a user name and password by specifying the useDefaultCredential property.

Below are some simple examples.

Read all users and export to a CSV file:

$pwaUrl = "http://vm353/pwatest"
$PSsvcUrl = $pwaUrl + "/_vti_bin/PSI/Resource.asmx?wsdl"
$c = Get-Credential
$svcPSProxy = New-WebServiceProxy -uri $PSsvcUrl -credential $c
$svcPSProxy.ReadUserList("ALL").Resources | Export-CSV C:\Resources.txt -Delimiter "|"

To read a specific resource us the ReadResource method and pass the res_UID to the resourceUID parameter:

$svcPSProxy.ReadResource("2B8767C3-DE3E-4343-8E51-B268697FB10F").Resources

Read Project Team:

$pwaUrl = "http://vm353/pwatest"
$svcProjectUrl = $pwaUrl + "/_vti_bin/PSI/Project.asmx?wsdl"
$c = Get-Credential
$svcProjectProxy = New-WebServiceProxy -uri $svcProjectUrl -credential $c
$svcProjectProxy.ReadProjectTeam("3DC95F6F-60C4-48CB-8DA0-AA28DA6E31FD").ProjectTeam
–will return all fields in the ProjectTeam dataset for the given project  GUID.

To return specified fields add the select command:

$svcProjectProxy.ReadProjectTeam("3DC95F6F-60C4-48CB-8DA0-AA28DA6E31FD").ProjectTeam | Select res_UID, Res_Name — will select limited fields from the dataset, in this case Resource UID and Resource Name.

It is also possible to run certain jobs from PowerShell, in the example below the archive projects job will run when the script is executed:

$pwaUrl = "http://vm353/pwatest"
$svcProjectUrl = $pwaUrl + "/_vti_bin/PSI/Archive.asmx?wsdl"
$c = Get-Credential
$svcProjectProxy = New-WebServiceProxy -uri $svcProjectUrl -credential $c
$svcProjectProxy.QueueArchiveProjects()

The following script will synchronise the PWA users and the SharePoint site membership:

$pwa = "http://vm353/pwatest"
$svcPSUrl = $pwa + "/_vti_bin/PSI/WssInterop.asmx?wsdl"
$c = Get-Credential
$svcPSProxy = New-WebServiceProxy -uri $svcPSUrl -credential $c
$svcPSProxy.SynchronizeMembershipForPwaAppRootSite()

These are just a few simple examples to show how quickly you can access the PSI with no code and not touching Visual Studio!

Details on the Project Server 2010 PSI can be found here:

http://msdn.microsoft.com/en-us/library/ms457477.aspx

Details on PowerShell can be found here:

http://msdn.microsoft.com/en-us/library/windows/desktop/aa973757(v=vs.85).aspx

Next Page »

Create a free website or blog at WordPress.com.
Entries and comments feeds.