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.

Advertisements

12 Comments »

RSS feed for comments on this post. TrackBack URI

  1. thank you for the post. 🙂

    In your script, do i replace the URL with my PWA url?

    • Hi Prasanna,

      Yes, just replace the http://vm353/pwatest URL with your PWA URL.

      Thanks
      Paul

  2. Awesome! Thank you

    • Thank you, hopefully it will be useful to others. 🙂

  3. great piece of information, something indeed required quite frequently.

  4. Absolutely useful and helpful, thank you very much for this.

    • You’re welcome, happy that you found this useful.
      Paul

  5. […] 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 […]

  6. […] 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 […]

  7. Hi,
    We performed a ‘Full upgrade’ from PS2007 to PS2010. Using the Script above does not remove ‘Compatibility Mode’. Publising the plans individually through Project 2010 does remove the ‘Compatbility Mode’. Can you shed some light on why the Powerscript ‘Publish All’ and the Project 2010 ‘Publish’ are different?
    Thanks
    David

    • Hi David,

      Opening the project in Project Pro 2010 will update the project file, just using the PSI will not do this. You could write a macro to open, save and publish all of your projects in Project Pro 2010.

      Thanks

      Paul


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: