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

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.

12 thoughts on “Publish all Projects in #ProjectServer using #PowerShell #MSProject #PS2010 #SP2010

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

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

Comments are closed.

Blog at WordPress.com.

Up ↑

%d bloggers like this: