Answered delete search service application

  • Wednesday, February 15, 2012 4:47 AM
     
     

    Hi,

    i have run

    Stsadm -o deleteconfigurationobject -id f19f0ab2-4b27-40b9-b46e-c5a93c551d32

    to delete search service application but it still running about half an hour. 

    pls tell what is the solution to delete search service application.

    thx


    iffi

All Replies

  • Wednesday, February 15, 2012 5:42 AM
     
     Answered

    Hi

    You can delete service application from Central admin site or by powershell script. Here is a function for deleting service application

    Function RemoveServiceApplication
    {
        param
        (
            $SvcAppName,
            $AppProxyName,
            $AppPoolName,
            [bool]$deleteData
        )
        Try
         {
            #Service Application
            $svcApp = Get-SPServiceApplication | ? {$_.DisplayName -eq $SvcAppName -or $_.ID -eq $SvcAppName} -ea SilentlyContinue
            if($svcApp -ne $null)
            {
                $count = $svcApp.Count
                if($count -gt 1)
                {
                     Write-Host -ForegroundColor White " - There are more than one service appliation with the name: $SvcAppName, please input the service application ID that you want to delete"
                     $svcApp | format-list -property DisplayName,TypeName,ID
                     $id =""
                     While($id -eq "" -or $svcApp -eq $null)
                     {
                        $id = Read-Host "Service Application ID:"
                        $svcApp = Get-SPServiceApplication $id -ea SilentlyContinue
                     }
                }
                Write-Host -ForegroundColor White " - Deleting Service Application: $SvcAppName"
                if($deleteData)
                {
                    Remove-SPServiceApplication -Identity $svcApp.ID -RemoveData
                }
                else
                {
                    Remove-SPServiceApplication -Identity $svcApp.ID
                }
                Write-Host -ForegroundColor White " - Service Application: $SvcAppName had been deleted"
                
            }
            else
            {
                Write-Host -ForegroundColor White " - The service application: $SvcAppName not found, continue..."
            }
            #App Pool
            $ApplicationPool = Get-SPServiceApplicationPool $AppPool -ea SilentlyContinue
               If ($ApplicationPool -ne $null)
            {
                Write-Host -ForegroundColor White " - Deleting SharePoint Hosted Services Application Pool..."
                Remove-SPServiceApplicationPool $ApplicationPool
                
                   If (-not $?) { Throw "Failed to delete the application pool" }
                Write-Host -ForegroundColor White " - SharePoint Hosted Services Application Pool had been deleted"
               }
            #App Proxy
            $appProxy = Get-SPServiceApplicationProxy | Where {$_.DisplayName -eq $AppProxyName} -ea SilentlyContinue
            if($appProxy -ne $null)
            {
                $count = $svcApp.Count
                if($count -gt 1)
                {
                     Write-Host -ForegroundColor White " - There are more than one service appliation proxy with the name: $AppProxyName, please input the service application Proxy ID that you want to delete"
                     $appProxy | format-list -property DisplayName,TypeName,ID
                     $id =""
                     While($id -eq "" -or $appProxy -eq $null)
                     {
                        $id = Read-Host "Service Application Proxy ID:"
                        $appProxy = Get-SPServiceApplication $id -ea SilentlyContinue
                     }
                }
                Write-Host -ForegroundColor White " - Deleting Service Application Proxy: $AppProxyName"
                if($deleteData)
                {
                    Remove-SPServiceApplicationProxy -Identity $appProxy.ID -RemoveData
                }
                else
                {
                    Remove-SPServiceApplication -Identity $appProxy.ID
                }
                Write-Host -ForegroundColor White " - Service Application: $AppProxyName had been deleted"
            }
         }
         Catch
         {
              Write-Output $_
         }
    }


    SharePoint 2010 PowerShell

  • Wednesday, February 15, 2012 2:24 PM
     
     Answered
    You can also delete it directly through Central Administration.

    Corey Roth - SharePoint Server MVP blog: www.dotnetmafia.com twitter: @coreyroth

  • Wednesday, February 15, 2012 2:58 PM
     
     Answered

    It's been a while since I really had to deal with search, maybe things have gotten better... But this rings a familiar bell...

    As I recall one of the problems with a search that had gone off to lala land was that you also have to remote to the box and stop the oseach14 service :

    Open a command prompt on your server and type in:

        net stop osearch14

    Then in CA you should see the services stopped, at which point you can delete them and start over.

    • Proposed As Answer by RobertSm Friday, February 17, 2012 5:42 PM
    • Marked As Answer by Rock Wang– MSFT Saturday, February 25, 2012 9:40 AM
    •