Removing Project Server 2010 Applications in SharePoint 2010
A common mistake is to remove a PWA Site Collection without doing this by the application manager. This error usually whoever incurs has several problems then the PWA won’t open anymore and sometimes cannot create new PWAs.
Cause
To delete the Site Collection was removed the pointer directly in the Web Application, but for the Service Project Server data is still a PWA with the database intact.
Symptom
When you try to delete now correctly by “Manage Service Applications” error occurs:
“Service application cannot be deleted due to existing project sites”
Solution
Enter SharePoint 2010 Management Shell and run the following sequence of commands:
Get-SPServiceApplication
$ID_App = Get-SPServiceApplication | ? {$_.Displayname -like “App Name”}
$Colecoes = $ID_App.SiteCollection
$Colecoes
$ID_App.SiteCollection.Remove(“22ffa7a9-17f1-4801-b648-cc7e1dbe2183”)
The first command lists all applications have been found and among them the PWA. You can create a filter for like, similar to the second command. Or if you already know the name of the applications put directly in the second row.
The second command captures the application ID and the third uses this ID to bring the list of Site Collections linked to PWA.
The fourth command lists the result of the variable $Colecoes so that you can read the ID of the Site Collection that is inserted into the ultimate dos commands.
After this, run the commands again 3 and 4 until that do not return any Site Collection, although the PWA is usually a single SC.
Below is the complete prints of each stage:
And don’t forget that you will not be deleted databases in SQL Server, what should be done manually before creating a new application for the PWA server.
Thank you so much for posting this .This is great .
Thanks Umar :)
Wow! Just was I was looking for.
I searched a lot to find this, and just before I gave up hope, I found your post – it saved me a lot of sleepless nights…
Thanks
Thanks Zoltanar, I am happy to help you.
Excellent! This was exactly what I needed! I had deleted a /pwa site collection without first unprovisioning it using the Project Server Service Application. Therefore I had a lot of errors in the event logs about how Project Server couldn’t find the databases and it was still trying to run timer jobs against them! They were also still appearing in the list at Central Admin –> Upgrade and Migration –> Review Database Status. They were listed as not responding. This article removed them from that list and cleared the errors in my event logs. Thanks for posting this gem of information!
In case it helps someone else searching on Google most of my errors were “Event 8115, Project Server” (logged as Error) and looked much like this:
An exception occurred while running the job scheduler.
Reason: Cannot open database “TEST_Published” requested by the login. The login failed.
Login failed for user ‘Domain\TESTUser’.
Technical Details:
System.Data.SqlClient.SqlException: Cannot open database “TEST_Published” requested by the login. The login failed.
Login failed for user ‘Domain\TestUser’.
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
**** and we had these in conjunction****
Event ID 6398, SharePoint Foundation, Timer: (logged as critical)
The Execute method of job definition Microsoft.Office.Project.Server.Administration.JobScheduler (ID 3e79d9dd-13e9-43f0-b56d-4a4c77ffd6c1) threw an exception. More information is included below.
Cannot open database “TEST_Published” requested by the login. The login failed.
Login failed for user ‘Domain\TESTUser’.
Thanks Wendy, I am happy to help you.
Your comments help others too!
Thanks you very much Wendy, Its very much helpful!!
Thanks, was important, Its very much helpful
Thanks Juan!
How can this be done on Project Server 2007 on Win 2003? I’ve use PowerShell on 2010, but unsure how to get it to work with old MOSS with the full set of SP commands.
Hi Fred, I not have a proceed in SPS 2007. PS of SPS 2010 is different of MOSS.
What is actually being deleted with these commands? The actually site collection or just the service application reference within the collection?
Hi George,
This commands delete site collection and associate service application, but not Project Server Service.
Regards!
I had previously removed all web and PS databases as well as the web application. However this still see’s a site collection. Where does it get this from the SP_Config db?
Hi KB, I dont see this error… Sorry :(
Excellent web site you have here.. It’s difficult to find good quality writing like yours these days. I seriously appreciate people like you! Take care!!
Thanks!
:D Excelent Post
Thanks Andres!
Thank you so much for posting this.
This helped me when trying to remove Project Server 2010 before upgrading my SharePoint server to 2013.
Just in case someone else struggles with the PowerShell script needed, You need to Copy the ID of the site collection, not the SiteId (Doh!). This worked for me:
——
$ID_App = Get-SPServiceApplication | ? {$_.Displayname -like “Project*”}
$Colecoes = $ID_App.SiteCollection
$Colecoes
$ID_App.SiteCollection.Remove(“930fcb2e-d6b9-4735-89b4-5704c9d5c940”)
—-
You can then unprovision the Service application via SPCA or PowerShell:
—–
$ID_App.Unprovision($false);
$ID_App.Delete();
———-
Thanks!