#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:


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
–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

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

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:


Details on PowerShell can be found here:




RSS feed for comments on this post. TrackBack URI

  1. […] on from a recent post on Project Server PSI PowerShell scripts, I thought of a nice slightly more advanced example. The […]

  2. Hi there,

    I’m struggling to edit my resource rates with PowerShell.
    I somehow can’t checkout the resource, due to some problem on the guid (doesn’t accept string, as far as I can see).
    Is it possible for you to provide some example that changes resource data and/or rates?


  3. how to retrieve projects in project center inside sharepoint2010 ,what can i do to do so???

    • Hi there,
      It depends on how you want to display the projects, in a web part, list, SSRS report etc. You could use T-SQL and access the Projects in the Project Server Reporting database for SSRS or a BCS app for example or use the PSI methods.


  4. Hi, thanks for the great info here! I’m trying some of these scripts out. I can always retrieve a list of properties and methods after I create a webservice proxy, but whenever I try to execute a method, I get an exception “Unhandled Communication Fault occurred” when I run this against an server running HTTPS. Against another server with HTTP, no problem. What am I missing?

    • Hi, thanks for the feedback. I’m not sure why you are seeing this error over HTTPS without testing / debugging. Which script are you running to get the error and I will test this on an HTTPS PWA site.


      • I was trying something simple like the ReadProjectList example. I originally was trying to follow the C# samples provided in the SDK, but I can’t get the wcf or asmx samples to work; they all return that same “Unhandled Communication Fault occurred.” The Project Server I’m hitting uses integrated authentication and I’m currently developing on a machine logged into with the same credentials as my access to the project server…

      • I see you have posted a query on the Project Server forums, I’m sure one of the developers there will be able to advise you 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.
Entries and comments feeds.

%d bloggers like this: