I had a test web application with PWA provisioned and I just deleted the web application without unprovisioning the PWA. Now I run Get-Spdatabase and I got those PWA databases showing there even after I deleted the databases from the SQL server. I tried to use STSADM –o deleteconfigurationobject –id <spdatabase_id> and this will complain that the database is referenced by a project site=Guid.

How do we get rid of the orphan PWA?

$sa = Get-SPServiceApplication | ? {$_.TypeName –eq “Project Server PSI Service Application”}

$sa.SiteCollection  … this will display all PWA including those orphaned ones – you need to locate those orphaned one and get the ID of that Site Collection then you remove them from the collection as follows:

$sa.SiteCollection.Remove(“Orphan PWA Site Collection GUID”)

$sa.Update()