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:
An example export looks like this:
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.