Showing posts with label service application. Show all posts
Showing posts with label service application. Show all posts

06 May, 2012

Sharepoint 2010 - Delete A service application using Powershell

Some times You will find that you are not able to Delete the Service Application using the GUI . That`s the time when I have used the Powershell Command which works almost 100 % and quick .

Before you delete a service application, verify that its removal will not adversely affect users. As a best practice, you should ensure that no Web applications are currently consuming the service application that you are going to delete

When you delete a service application, you have the option to also delete the service application database (not all service applications have databases).

To delete a service application by using Windows PowerShell

  • On the Start menu, click All Programs.
  • Click Microsoft SharePoint 2010 Products.
  • Click SharePoint 2010 Management Shell.
  • At the Windows PowerShell command prompt, type the following commands.
To retrieve the service application that you want to delete, type the following command

$spapp = Get-SPServiceApplication -Name "<Service application display name>"

Where <Service application display name> is the display name of the service application that you want to delete.

The service application information will be stored in the $spapp variable Or You can also UseGet-SPServiceApplication cmdlet to list all service applications

To delete the selected service application, run one of the following commands. In both cases, you are prompted to confirm the deletion.

To delete the selected service application without removing the service application database, type the following command:

Remove-SPServiceApplication $spapp

To delete the selected service application and also delete the service application database, type the following command:

Remove-SPServiceApplication $spapp -RemoveData

If you Know the ID of the service application Then you can Also Use

Remove-SPServiceApplication -Identity <ID> -Remove Data