Skip to content

blksthl

Mostly what I know and share about…

Month: November 2013

Delete the Service Applications of SharePoint 2013


‘

Delete Service Applications in SharePoint 2013

Candyxx
Too much candy?

Cheers all!

I have noted that it is not always that easy to get rid of a Service Application should you wish to remove it completely. It can be either during initial setup, after a service breakdown or for any other reason, you want it gone and you want it to be completely gone when you are done. The next step is often to set it up again from scratch…so any remnants will cause you problems.

So, which way is the easiest to choose? I say PowerShell, 100(or maybe 99) out of 100.

Below, I have for your convenience created oneliners that will take care of all of your Service Applications for you.

After each Command, add the flag -RemoveData to have all data and databases removed at the same time.
Use the -RemoveData with care though, be absolutely sure that all data absolutely needs to be deleted Before using the flag.

‘
‘

The commands available, in alphabetical order

Service Application
Command
Access Services Remove-SPServiceApplication -id (Get-SPServiceApplication | Where-Object {$_.typename -like “Access Services”} | Select-Object id).id.tostring()
Access Services 2010 Remove-SPServiceApplication -id (Get-SPServiceApplication | Where-Object {$_.typename -like “Access Services 2010*”} | Select-Object id).id.tostring()
Application Discovery and Load Balancer Service Application  Remove-SPServiceApplication -id (Get-SPServiceApplication | Where-Object {$_.typename -like “Application Disc*”} | Select-Object id).id.tostring()
App Management Service Remove-SPServiceApplication -id (Get-SPServiceApplication | Where-Object {$_.typename -like “App man*”} | Select-Object id).id.tostring()
Business Data Connectivity service Remove-SPServiceApplication -id (Get-SPServiceApplication | Where-Object {$_.typename -like “Business*”} | Select-Object id).id.tostring()
Excel Services Application Remove-SPServiceApplication -id (Get-SPServiceApplication | Where-Object {$_.typename -like “Excel*”} | Select-Object id).id.tostring()
Machine Translation Service Remove-SPServiceApplication -id (Get-SPServiceApplication | Where-Object {$_.typename -like “Machine Translation*”} | Select-Object id).id.tostring()
Managed metadata Remove-SPServiceApplication -id (Get-SPServiceApplication | Where-Object {$_.typename -like “Managed metadata*”} | Select-Object id).id.tostring()
PerformancePoint Service Application Remove-SPServiceApplication -id (Get-SPServiceApplication | Where-Object {$_.typename -like “Performance*”} | Select-Object id).id.tostring()
PowerPoint Conversion Service Application Remove-SPServiceApplication -id (Get-SPServiceApplication | Where-Object {$_.typename -like “PowerPoint Conv*”} | Select-Object id).id.tostring()
Search Administration Web Service Application Remove-SPServiceApplication -id (Get-SPServiceApplication | Where-Object {$_.typename -like “Search Admin*”} | Select-Object id).id.tostring()
Search Service Application Remove-SPServiceApplication -id (Get-SPServiceApplication | Where-Object {$_.typename -like “Search Service*”} | Select-Object id).id.tostring()
Secure Store Service Application Remove-SPServiceApplication -id (Get-SPServiceApplication | Where-Object {$_.typename -like “Secure Store*”} | Select-Object id).id.tostring()
Security Token Service Application Remove-SPServiceApplication -id (Get-SPServiceApplication | Where-Object {$_.typename -like “Security Token*”} | Select-Object id).id.tostring()
State Service Remove-SPServiceApplication -id (Get-SPServiceApplication | Where-Object {$_.typename -like “State Service*”} | Select-Object id).id.tostring()
Usage and Health Data Collection Service Application Remove-SPServiceApplication -id (Get-SPServiceApplication | Where-Object {$_.typename -like “Usage and Health*”} | Select-Object id).id.tostring()
User Profile Service Application Remove-SPServiceApplication -id (Get-SPServiceApplication | Where-Object {$_.typename -like “User Profile*”} | Select-Object id).id.tostring()
Visio Graphics Service Remove-SPServiceApplication -id (Get-SPServiceApplication | Where-Object {$_.typename -like “Visio*”} | Select-Object id).id.tostring()
Word Automation Services Remove-SPServiceApplication -id (Get-SPServiceApplication | Where-Object {$_.typename -like “Word auto*”} | Select-Object id).id.tostring()
Work Management Service Application Remove-SPServiceApplication -id (Get-SPServiceApplication | Where-Object {$_.typename -like “Work Management*”} | Select-Object id).id.tostring()

Running the commands above will look something like this

DeleteServiceApp

Note: Beware of the signle and double quotes if you copy the code…quotesx

‘References

Delete a service application in SharePoint 2013
http://technet.microsoft.com/en-us/library/ee704553.aspx

Remove-SPServiceApplicationPool
http://technet.microsoft.com/en-us/library/ff607921.aspx

_________________________________________________________

Enjoy!

Regards

Twitter | Technet Profile | LinkedIn

Thomas Balkeståhl Features, Powershell, Service Application, Service Application, Setup, SharePoint 2013, SharePoint Server 2013 3 Comments November 27, 2013March 5, 2014 2 Minutes

Managing the Distributed Cache Service in SharePoint 2013


Managing the Distributed Cache Service in SharePoint 2013 using PowerShell

MultipurposeTractorx
A true multipurpose tractor

Greetings SharePoint Campers!

This time I will just offer a brief cheat sheet for Distributed Cache operations using powershell, which is pretty much the only way you can configure and manage the service.
For some reason, the Distributed Cache seems to offer a lot of people grief, all from no functionality at all to extremely slow responsetimes on all pages loaded (see SharePoint 2013 page loads takes a very long time).

My best tip, the often working quick fix with a malfunctioning cache service, is to first try and stop and start it, then if its still failing, delete the service and add it back again. You should also from the start change the default service account from the farm account to a separate, maybe dedicated managed account.

Quick fix
1.
Stop the service
Start the service
2.
Delete the service
Create a new service
3.
Start checking the logfiles and do a proper t-shooting.

Remember that in a multiserver farm, the PowerShell commands will affect the server where the command has been executed, so make sure to be on the correct server Before runing the CMDlets.

Distributed Cache tasks listed in the following order:

Change the service account running the Distributed Cache
Graceful stop and deattach local server (No lost cache data)
Dettach local server from a cache cluster (Multiple Distributed Cache servers)
Reattach local server to a cache cluster (Multiple Distributed Cache servers)
Delete the service
Create a new service
Start the service on a server
Stop the service on a server
Check current Cache memory allocation
Change the Cache memory allocation
References
Change the service account running the Distributed Cache

It is recommended to use a SharePoint managed account for this service.
$spfarm = Get-SPFarm
$spcacheService = $spfarm.Services | where {$_.Name -eq “AppFabricCachingService”}
$spaccount = Get-SPManagedAccount -Identity domain\spdistcache
$spcacheService.ProcessIdentity.CurrentIdentityType = “SpecificUser”
$spcacheService.ProcessIdentity.ManagedAccount = $spaccount
$spcacheService.ProcessIdentity.Update()
$spcacheService.ProcessIdentity.Deploy()

CurrentIdentityType = “SpecificUser” should be just that and nothing else, do not replace this value

Verify by going to Central administration, Security, Configure Service accounts, Select ‘Windows Service – Distributed Chache’ i dropdown, that the service account has been replaced.

Graceful stop and deattach local server (No lost cache data)

Stop-SPDistributedCacheServiceInstance -Graceful
Remove-SPDistributedCacheServiceInstance

Deattach local server from a cache cluster (Multiple Distributed Cache servers)

Remove-SPDistributedCacheServiceInstance

Reattach local server to a cache cluster (Multiple Distributed Cache servers)

Add-SPDistributedCacheServiceInstance

Delete the service

$instanceName =”SPDistributedCacheService Name=AppFabricCachingService”
$serviceInstance = Get-SPServiceInstance | ? {($_.service.tostring()) -eq $instanceName -and ($_.server.name) -eq $env:computername}
$serviceInstance.delete()

Verify in Central Admin, System Settings, Manage Services on Server. It should be gone from this list when it has been completely deleted.
In a multi server farm, you will have to select which server to show the services from in the top-right dropdown.

Create a new service

Add-SPDistributedCacheServiceInstance

Verify in Central Admin, System Settings, Manage Services on Server. It should appear in this list when it has been created. In a multi server farm, you will have to select which server to show the services from in the top-right dropdown.

Start the service on a server

$instanceName =”SPDistributedCacheService Name=AppFabricCachingService”
$serviceInstance = Get-SPServiceInstance | ? {($_.service.tostring()) -eq $instanceName -and ($_.server.name) -eq $env:computername}
$serviceInstance.Provision()

Stop the service on a server

$instanceName =”SPDistributedCacheService Name=AppFabricCachingService” $serviceInstance = Get-SPServiceInstance | ? {($_.service.tostring()) -eq $instanceName -and ($_.server.name) -eq $env:computername}
$serviceInstance.Unprovision()

Check current Cache memory allocation

Use-CacheCluster Get-AFCacheHostConfiguration -ComputerName $env:computername -CachePort “22233”

Change the Cache memory allocation

On all Cache servers in the farm stop the service
$instanceName =”SPDistributedCacheService Name=AppFabricCachingService” $serviceInstance = Get-SPServiceInstance | ? {($_.service.tostring()) -eq $instanceName -and ($_.server.name) -eq $env:computername}
$serviceInstance.Unprovision()
Update the memory allocation
Update-SPDistributedCacheSize -CacheSizeInMB CacheSize
Start the service on all Cache servers
$instanceName =”SPDistributedCacheService Name=AppFabricCachingService” $serviceInstance = Get-SPServiceInstance | ? {($_.service.tostring()) -eq $instanceName -and ($_.server.name) -eq $env:computername}
$serviceInstance.Provision()

CacheSize is the cache size’s memory allocation assignment in MB

‘

Note: Beware of the signle and double quotes if you copy the code…quotesx

‘

References

Manage the Distributed Cache service in SharePoint Server 2013
http://technet.microsoft.com/en-us/library/jj219613.aspx

Plan and use the Distributed Cache service in SharePoint Server 2013 (Poster)
http://www.microsoft.com/en-us/download/confirmation.aspx?id=35557

_________________________________________________________

Enjoy!

Regards

Twitter | Technet Profile | LinkedIn

Thomas Balkeståhl Powershell, Setup, Setup, SharePoint 2013 1 Comment November 27, 2013November 27, 2013 3 Minutes

Recent Posts

  • Adding a User Defined Route for API Management with a Service Tag via Bicep

Meta

  • Create account
  • Log in
  • Entries feed
  • Comments feed
  • WordPress.com

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 121 other subscribers
Blog at WordPress.com.
Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy
  • Subscribe Subscribed
    • blksthl
    • Join 121 other subscribers
    • Already have a WordPress.com account? Log in now.
    • blksthl
    • Subscribe Subscribed
    • Sign up
    • Log in
    • Report this content
    • View site in Reader
    • Manage subscriptions
    • Collapse this bar
 

Loading Comments...