none
Removing "orphaned" Project Server Service Application RRS feed

  • Question

  • I am working in a test environment with Project Server 2010 and SharePoint 2010. While running through disaster recovery scenarios I came across trying to delete a Projet Server Service Application where the 5 DB's were "lost". When I manage the Service Application it shows no PWA sites. However, when I go to delete the Service Application I receive the error "Service application cannot be deleted due to existing project sites". I also get this when trying to delete the Service App using the Remove-SPServiceApplication. I've tried the -removedata option with the cmdlet without any luck either.

    I also tried uninstalling Project Server from the Application Server and reinstalling it after but the orphaned Service App comes back after it has been reinstalled.

    How can I go about removing this Service Application?

    Wednesday, July 28, 2010 4:46 PM

Answers

  • Well, at long last, we have a resolution!

     

    Alexander and I(mostly Alex :) ) worked on this over the weekend, and this is what we came up with:

     

    $psi = get-spserviceapplication | ? {$_.Typename -like "*Project*}
    $psi

    Outcome : This will return the various Project service applications

    $sa = get-spserviceapplication | ? {$_.Id -eq "GUID of the Service App from above"}
    $sa

    Outcome : Assign the individual service app object to $sa and verify it has been set.

    $sc = $sa.SiteCollection
    $sc

    Outcome : Will assign the SiteCollection details to $sc and display the contents.

    Note Id value.

    $sa.SiteCollection.Remove("Site Collection ID from above");
    $sc

    Outcome : The $sc should return nothing as the site collection has been removed. You should then be able to go into CA and delete the service app without error.

    Monday, February 7, 2011 2:31 PM
  • Hi Mikael,

    Was the PWA instance deleted from within the Service Application?  Was this deletion allowed to complete?  It does sound like some remnant is left behind, and most likely in the SharePoint config database.  Your ULS logs might give some clues, but you may well need to have a support incident opened with Microsoft to get the right clean up steps.  If this is just a test environment then leaving the farm and then re-creating a new SharePoint config database might be the best course of action - and re-using any content and project databases you already have - but re-creating the service applications.

    Best regards,

    Brian.


    Blog | Facebook | Twitter | Posting is provided "AS IS" with no warranties, and confers no rights.
    Project Server TechCenter | Project Developer Center | Project Server Help | Project Product Page
    Thursday, July 29, 2010 9:40 PM
    Owner

All replies

  • Hello Mikael

    You mention that 5 databases were lost.  Try first removing the databases from config and then try removing the service application.

    Cheers!

    Michael Wharton, MBA, PMP, MCT


    Sincerely, Michael Wharton, MBA, PMP, MCT, MCSD, MCSE+I, MCDBA www.WhartonComputer.com
    Wednesday, July 28, 2010 4:52 PM
    Moderator
  • When I manage the Service Application no PWA site shows up. Is that the config area you are talking about?
    Wednesday, July 28, 2010 4:58 PM
  • Hi Mikael,

    Was the PWA instance deleted from within the Service Application?  Was this deletion allowed to complete?  It does sound like some remnant is left behind, and most likely in the SharePoint config database.  Your ULS logs might give some clues, but you may well need to have a support incident opened with Microsoft to get the right clean up steps.  If this is just a test environment then leaving the farm and then re-creating a new SharePoint config database might be the best course of action - and re-using any content and project databases you already have - but re-creating the service applications.

    Best regards,

    Brian.


    Blog | Facebook | Twitter | Posting is provided "AS IS" with no warranties, and confers no rights.
    Project Server TechCenter | Project Developer Center | Project Server Help | Project Product Page
    Thursday, July 29, 2010 9:40 PM
    Owner
  • What is the solution to this?  My Project Service database was lost and I need to delete the service application, but receive an error that it still has data.

    Thursday, October 21, 2010 10:44 PM
  • John,

    If you're getting the "Service application cannot be deleted due to existing project sites" message, you can try and remove the reference to the non-existent site collection using the Object Model. Here's how I did it with PowerShell:

    $psi = Get-SPServiceApplication | ? {$_.TypeName -like "*Project*"};
    $psi.SiteCollection.Remove($psi.SiteCollection.Id);
     

    Then you can delete the Service App from Central Administration, or complete the operation in PowerShell: 

    $psi.Unprovision($false);
    $psi.Delete();

    • Proposed as answer by Lehus Friday, September 21, 2018 1:57 PM
    Friday, October 22, 2010 10:36 AM
  • Hi John

    Im runnig the your PowerShell but I am getting an error:

    Cannot convert argument "0", with value: "", for "Remove" to type "System.Guid"
    : "Cannot convert null to type "System.Guid"."
    At line:1 char:27
    + $psi.SiteCollection.Remove <<<< ($psi.SiteCollection.Id);
        + CategoryInfo          : NotSpecified: (:) [], MethodException
        + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

     

    Any idea about this error? I can not delete the project Service not even from central administration or power shell there is any way just to get just the site collection id

     

     

    Wednesday, November 17, 2010 10:16 PM
  • Same problem here...
    Tuesday, November 30, 2010 5:29 PM
  • I don't have an answer beyond what has already been given, but I am keen to understand how you each have got to the point of needing to do this.  Ordinarily things should be handled via the UI and orphaned entries not left hanging.  If there are scenarios that lead to this situation we need to know what they are - and understand if we have a technical issue or perhaps a documentation issue in removing PWA instances and the associated entities.

    Also if I can re-create this scenario in the same way you have then I can perhaps come up with a supported way to get fixed.

    Best regards,

    Brian.


    Blog | Facebook | Twitter | Posting is provided "AS IS" with no warranties, and confers no rights.
    Project Server TechCenter | Project Developer Center | Project Server Help | Project Product Page
    Tuesday, November 30, 2010 8:22 PM
    Owner
  • In my case, I had a project service app and associated project databases(publishing, archiving, reporting, etc) for which the PWA deployment stuck in provisioning status, particularly "waiting for resources." I had deployed this upon a new web application to keep it separate from my Sharepoint team sites.  The new application was, if I recall, on port 83.  After several days of being stuck in the aforementioned status, I decided to try one more time.  I created a new SA, a new set of databases, and depoyed it to a new web application...port 87.  This time, everything worked without issue, and at that point our users were able to access the PWA via their client and browser.  However, I was still left with the "stuck" provisioning PWA.  I could do nothing with it...I couldn't cancel it, stopping the timer job associated with the deployment did nothing...it was hung in limbo.  I knew that I needed to delete the PWA site via the UI if I wanted to remove the now stale SA, but I wasn't given any option to do so while it was hung in the "waiting for resources" state.  Here is where I likely made my crucial error:

    1.  I attempted to delete or even detach the DBs associated with the "bad" project site.  I was given an error within SSMS about the databases being in use. 

    2. I removed the web application(port 83) that the "bad" instance was provisioning to(stupid), hoping that would force the deployment to "error out," and hopefully allow me to delete the site and service application.  No such luck.  To this day, the PWA is "waiting for resouces," this time with a path of http:// <web application not found> /pwa , and I am unable to delete the SA, due to a sites being associated with it.

     

    I had more or less resigned myself to "living with it" until today, when I tried to apply the October cumulative rollup, and everything errored out with exceptions tracing to that rogue project site.

    I'm at the end of my rope here, and I'm trying to find a way to do this without calling MS, given that it will come out of my pocket if I have to do so.

     

    Let me know if there's anymore info that I can provide that could(hopefully) facilitate a solution.

     

    Tuesday, November 30, 2010 9:51 PM
  • I used the command $psi.SiteCollection to view all of the properties of the SiteCollection object including the Id.  I then hard coded the GUID in the next command $psi.SiteCollection.Remove("<guid>") and then completed the remaining steps.  After that I just had to remove the databases from SQL Server.

    Thanks,

    Sean

    Thursday, December 30, 2010 9:35 PM
  • Sean,

     

    Two months later, i'm still wrestling this...would you mind providing the exact commands you used?  The original commands provided gave me the above error, but if you found a way to make it work, I'd appreciate something else to try.

     

    Thanks!

    Wednesday, February 2, 2011 7:52 PM
  • We had a similar problem recently with an orphaned PWA service app, here is the Powershell we used:

    $psi = get-spserviceapplication | where {$_.TypeName -like "*Project*"};

    $psi

    $a = $psi.Sitecollection | where {$_.SiteID -eq "<Guid>"}

    $a

    $a.Delete()

    $a= $psi.Sitecollection | where {$_.SiteID -eq "<Guid>"}

    $a

     





    Alex Burton
    www.epmsource.com | Twitter
    Project Server TechCenter | Project Developer Center | Project Server Help | Project Product Page
    • Proposed as answer by VincentCO Thursday, June 13, 2013 1:24 PM
    Thursday, February 3, 2011 12:03 AM
    Moderator
  • Well, at long last, we have a resolution!

     

    Alexander and I(mostly Alex :) ) worked on this over the weekend, and this is what we came up with:

     

    $psi = get-spserviceapplication | ? {$_.Typename -like "*Project*}
    $psi

    Outcome : This will return the various Project service applications

    $sa = get-spserviceapplication | ? {$_.Id -eq "GUID of the Service App from above"}
    $sa

    Outcome : Assign the individual service app object to $sa and verify it has been set.

    $sc = $sa.SiteCollection
    $sc

    Outcome : Will assign the SiteCollection details to $sc and display the contents.

    Note Id value.

    $sa.SiteCollection.Remove("Site Collection ID from above");
    $sc

    Outcome : The $sc should return nothing as the site collection has been removed. You should then be able to go into CA and delete the service app without error.

    Monday, February 7, 2011 2:31 PM
  • This doesn't really get rid of the orphaned service applications.  If you try to recreate another service application with the same name as those that you deleted via this method you will get an error that a service application with that name already exists even after it was deleted via the GUI.  Nice clean-up tool for the UI I guess though.
    Tuesday, February 22, 2011 8:51 PM
  • Nashville Dude.. you are the man. Worked on upgrading SP1 2010 for over 12 hours and then somehow ended up at this. Rediculously simple and fixed the problem

    Issue was that the Upgrade error log was posting the wrong SiteID for the Orphaned project and that was Frustratingly Impossible to find. Your Solution helped out tremendously.. Kudos


    Jawad
    Monday, September 19, 2011 9:28 AM
  • Hi Alex,

    I followed your posting http://epmsource.com/2011/05/31/common-errors-when-a-pwa-site-is-deleted-incorrectly/ to remove PWA instances. USed up to Step 2 and in Step3 R"emove the configuration for the incorrectly deleted instance", Command 1 "$toberemoved = $pwainstances | ? {$_.Id –eq “<Id of the instance to delete>”}" doesn't do any thing.No response. Am I doing anything wrong?

    Senbag

    Monday, August 20, 2012 2:52 PM
  • Or if you don't want to type "ID from above" (also need a quote after Project*)

    $psi = get-spserviceapplication | ? {$_.Typename -like "*Project*"}
    $psi

    $sa = get-spserviceapplication | ? {$_.Id -eq $psi.id}
    $sa

    $sc = $sa.SiteCollection
    $sc

    $sa.SiteCollection.Remove($sc.id); 

    Friday, August 26, 2016 1:52 PM
  • Hi, 

    I had the same issue, as most solutions didn't work at all.

    But Sean resolution gave me a hope which I have used in my SAND environment. Finally this works perfect!.

    First go to the powershell cmd and type: $psi.SiteCollection

    This will show up PsiServiceApplication details like: databases, name and the most important: "Id" field which is just below "DisplayName" field. Please copy entire GUID and type the new command like: 

    PS C:\Users\User> $psi.SiteCollection.Remove("5ec79f71-cffe-448f-g7b4-c6bd02f1a4b3")

    Now please go back to the Manage Service Applications in CA and try to delete the Project Server Service.

    This time this will work!

    • Proposed as answer by Przemek Cz PL Monday, March 11, 2019 9:06 AM
    Monday, March 11, 2019 9:05 AM