Friday, February 17, 2012

PowerShell Scripting - SharePoint 2010 cmdlets

Hi Folks,

Following are the some useful Powershell cmdlets for reference

Script to Remove SharePoint 2010 Search Service Application

$SearchServiceApplication = Get-SPServiceApplication |?{$_Name -eq "Search Service Application"}
Remove-SPSericeApplication -Identity $SearchServiceApplication.Id -RemoveData

If it Still didn't work, you can you the following command

stsadm.exe deleteconfigurationobject -id "GUID of the SearchService Application"

To obtain the GUID of the Search Service Application From the UI Navigate to the service applications page. Mouse-over the search application link, and observe the id in the status bar.


Remove Database reference

Get-SPDatabase | ft Name, Id

$DatabaseToDelete = Get-SPDatabase {GUID of the database to delete}
$DatabaseToDelete | ft Name, Id
$DatabaseToDelete.Delete()

Get-SPDatabase | ft Name, Id


DeleteService Applicaqtion Application pool

Get-SPServiceApplicationPool | Select Id, Name

$AppPoolToDelete = Get-SPServiceApplicationPool -Identity "NameOfTheServiceApplicationPool"

Remove-SPServiceApplicationPool $AppPoolToDelete

Get-SPServiceApplicationPool | Select Id, Name

4 comments:

rayden said...

1: stsadm.exe -o deleteconfigurationobject
2: -id

Unknown said...
This comment has been removed by the author.
share point masters said...

Hey very nice blog!!
Hi there,I enjoy reading through your article post, I wanted to write a little comment to support you and wish you a good continuationAll the best for all your blogging efforts.
Appreciate the recommendation! Let me try it out.
Keep working ,great job!
Sharepoint training

share point masters said...

Valuable information and excellent design you got here! I would like to thank you for sharing your thoughts and time into the stuff you post!!
Sql dba training