REmoving Service Applications

If you are planning to cleanup your service applications and stop the services you can use the PowerShell script below.  Below script does not cover all service applications.

Add-PSSnapin Microsoft.SharePoint.Powershell -ErrorAction SilentlyContinue

$AccessServiceProxy = Get-SPServiceApplicationProxy | ?{$_.Name -eq "Access"}
if($AccessServiceProxy -ne $null)
{
    Remove-SPServiceApplicationProxy $AccessServiceProxy -RemoveData -Confirm:$false
    Write-Host -ForegroundColor Green "Access Service Application Proxy is Deleted" 
}
else { Write-Host -ForegroundColor Red "Did not found Access Service Application Proxy"  }

$AccessService = Get-SPServiceApplication | ?{$_.Name -eq "Access"}
if($AccessService -ne $null)
{
    Remove-SPServiceApplication $AccessService -RemoveData -Confirm:$false
    Write-Host -ForegroundColor Green "Access Service Application is Deleted" 
}
else { Write-Host -ForegroundColor Red "Did not found Access Service Application"  }
$AccessServiceInstance = Get-SPServiceInstance | ? {$_.TypeName -eq "Access Database Service 2010"}
$AccessServiceInstance | Stop-SPServiceInstance -Confirm:$false


$PowerPointProxy = Get-SPServiceApplicationProxy | ?{$_.Name -eq "PowerPointConversion Proxy"}
if($PowerPointProxy -ne $null)
{
    Remove-SPServiceApplicationProxy $PowerPointProxy -RemoveData -Confirm:$false
}
else { Write-Host "Did not found PowerPoint Service Application Proxy" }

$PowerPoint = Get-SPServiceApplication | ?{$_.Name -eq "PowerPointConversion"}
if($PowerPoint -ne $null)
{
    Remove-SPServiceApplication $PowerPoint -RemoveData -Confirm:$false
}
else { Write-Host "Did not found PowerPoint Service Application" }
Sleep 2
$PowerPointServiceInstance = Get-SPServiceInstance | ? {$_.TypeName -eq "PowerPoint Conversion Service"}
$PowerPointServiceInstance | Stop-SPServiceInstance -Confirm:$false

$MachineProxy = Get-SPServiceApplicationProxy | ?{$_.Name -eq "MachineTranslation"}
if($MachineProxy -ne $null)
{
    Remove-SPServiceApplicationProxy $MachineProxy -RemoveData
}
else { Write-Host "Did not found Machine Translation Service Application" }
$Machine = Get-SPServiceApplication | ?{$_.Name -eq "MachineTranslation"}
if($Machine -ne $null)
{
    Remove-SPServiceApplication $Machine -RemoveData
}
else { Write-Host "Did not found Machine Translation Service Application" }
Sleep 2
$MachineServiceInstance = Get-SPServiceInstance | ? {$_.TypeName -eq "Machine Translation Service"}
$MachineServiceInstance | Stop-SPServiceInstance -Confirm:$false

$VisioProxy  = Get-SPServiceApplicationProxy | ?{$_.Name -eq "VisioGraphics Proxy"}
if($VisioProxy -ne $null)
{
    Remove-SPServiceApplicationProxy $VisioProxy -RemoveData  -Confirm:$false
}
else { Write-Host "Did not found Visio Service Application" }

$Visio  = Get-SPServiceApplication | ?{$_.Name -eq "VisioGraphics"}
if($Visio -ne $null)
{
Remove-SPServiceApplication $Visio -RemoveData  -Confirm:$false
}
else { Write-Host "Did not found Visio Service Application" }
Sleep 2
$VisioServiceInstance = Get-SPServiceInstance | ? {$_.TypeName -eq "Visio Graphics Service"}
$VisioServiceInstance | Stop-SPServiceInstance -Confirm:$false

$WordAutomationProxy = Get-SPServiceApplicationProxy | ?{$_.Name -eq "WordAutomation"}
if($WordAutomationProxy -ne $null)
{
    Remove-SPServiceApplicationProxy $WordAutomationProxy -RemoveData  -Confirm:$false
}
else { Write-Host "Did not found Word Automation Service Application" }

$WordAutomation = Get-SPServiceApplication | ?{$_.Name -eq "WordAutomation"}
if($WordAutomation -ne $null)
{
Remove-SPServiceApplication $WordAutomation -RemoveData  -Confirm:$false
}
else { Write-Host "Did not found Word Automation Service Application" }
Sleep 2
$WordAutomationServiceInstance = Get-SPServiceInstance | ? {$_.TypeName -eq "Word Automation Services"}
$WordAutomationServiceInstance | Stop-SPServiceInstance -Confirm:$false
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s