Thursday, 8 December 2011

Manage services on SharePoint 2010 servers using PowerShell

As you may already know, you can use the “Manage Services on Server” option from Central Administration to centrally start and stop service instances across all SharePoint servers in your farm. An example of this administration page is shown below:


The issue with this page is that it can be cumbersome to use if there are a few servers in your farm and you keep having to click the “Server” drop-down to select one of them. It is also not very repeatable and there may be issues where you might want to automate the process – for example, stopping the User Profile Synchronization Service before a backup or application update and restarting it once complete.

You can get a similar list to the one shown in Central Admin using PowerShell by typing the following command:

Get-SPServiceInstance -Server PAC-SP2010 | sort TypeName | Format-Table -AutoSize

This will not only provide the service name and status, but also the service instance GUID:


There are a couple of ways to stop a service instance. Firstly, the most user friendly method, which is to use the service display name and then call the Stop-SPServiceInstance cmdlet:

Get-SPServiceInstance -Server PAC-SP2010  | where-object {$_.TypeName -eq "Managed Metadata Web Service" } | Stop-SPServiceInstance -Confirm:$false

There are a couple of things to note here:

  • The -Server switch is not required if you are configuring service instances for the server you are currently logged into
  • The -Confirm:$false switch is also optional. Setting this to $false supresses the confirmation prompt that appears when attempting to stop the service instance through PowerShell
  • You can also use the Stop-SPServiceInstance cmdlet directly by specifying the service instance GUID, as shown below for the Managed Metadata Web Service on this farm:

    Stop-SPServiceInstance -Identity 3f36d0f4-ce39-48aa-a776-6300f1e2b58f -Confirm:$false


    Restarting the service is simply a case of typing either of the same commands as before, but this time replacing Stop-SPServiceInstance with Start-SPServiceInstance.

    First example:

    Get-SPServiceInstance -Server PAC-SP2010  | where-object {$_.TypeName -eq "Managed Metadata Web Service" } | Start-SPServiceInstance -Confirm:$false

    Second example:

    Start-SPServiceInstance -Identity 3f36d0f4-ce39-48aa-a776-6300f1e2b58f -Confirm:$false

    That’s great, but you also might want to check a service instance has a particular status before attempting to stop or start it. In the example below, the Managed Metadata Web Service instance is associated with the $serviceinstance variable and the Status is checked to make sure it is “Online” before attempting to stop the service instance:

    $serviceinstance = Get-SPServiceInstance -Server PAC-SP2010  | where-object {$_.TypeName -eq "Managed Metadata Web Service" }
    if ($serviceinstance.Status -eq "Online")
        Write-Host "Stopping Managed Metadata Web Service on PAC-SP2010"
            $serviceinstance | Stop-SPServiceInstance -Confirm:$false
        catch { Write-Host "There was an error:" $_ }
        Write-Host "Managed Metadata Web Service on PAC-SP2010 has already been stopped"


    1. Very Nice Friends..

      i am From colombia and you Blog very nice.


      Andres Franco

      1. Great Article Cloud Computing Projects

        Networking Projects

        Final Year Projects for CSE

        JavaScript Training in Chennai

        JavaScript Training in Chennai

        The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training

    2. Hi Phil.

      Thanks for this.
      How would i write a script which lists all the service applications on each server.

      I have started it of as
      $ = (get-spfarm).Servers #gets the number of servers in the farm

      But i need to do a for each loop for each SharePoint server (excluding the sql) so it gives loops through each server and displays the Service Applications for each server.
      How can this be acheived?


    3. Maybe something like this:

      (get-spfarm).servers | where {$_.Name -ne "SQL"} | foreach {write-host "====== $_ ======";Get-SPServiceInstance -Server $ | sort status,typename | ft}

    4. This is simply awesome. thanks for sharing this!!

    5. How do I remove the service entirely (not just stop it)?

    6. great information !

    7. Thanks for your valuable posting.I have collect more than information from your website. It is really wonderful blog. please added more than tips. i'm working in Erp in india.Here providing very low price and Quality ERP,Cloud ERP, CMS , responsive webdesign and ERP. you have any more than information kindly make me call this number 044-42127512 or send your mail

    8. Manage services on SharePoint 2010 servers using PowerShell :

      How to Get from CSV file values(servername,status,type) using Powershell?.

      1. i am control values are csv file oly so how to write script


    9. شركة كشف تسربات المياه

      شركة البيت السعيد
      طرق شركة البيت السعيد شركة كشف تسربات المياه في عزل تسربات المياه:
      إذا تسربات المياه قد تكون في الأسطح المشربة بمياه الأمطار أو مياه الخزانات إذا كانت الخزانات تسرب المياه ، وفي هذا الحالة فإن شركة البيت السعيد شركة كشف تسربات المياه تقوم بـ عزل الأسطح بمادة الفوم وهي من المواد المفضلة لدى الجميع، حيث إن الفوم خفيف الوزن، ويتميز بالعزل الحراري والمائي معًا.
      شركة كشف تسربات المياه بالرياض

      البيت السعيد
      للاستفسار عن جميع خدمات البيت السعيد عزل مائي و عزل حراري و عزل اسطح و عزل خزانات و عزل فوم وجميع انواع العوازل و رش مبيد و مكافحة حشرات و تسليك مجاري و كشف تسربات المياه
      و فحص فلل
      و صيانة مباني و ترميم منازل و نقل عفش و اثاث بالرياض يرجي الاتصال على 0543578920
      او زورو موقعنا على الانترنت 

    10. If you have a history of illness that is difficult to recover, maybe our next article will help you to recover

      Obat gonore
      Obat Kudis
      Obat tipes
      Obat nyeri panggul
      Obat tetanus

    11. Most global offering pays partly and Pitney Bowes corporation. Find out clears in brand new window case or tabWe supply 90 Day service contract entirely contrary to manufacturers flaws. If a physical product does not need to element compared path of the car maker's demands(Otherwise go well with your opportunity classification), It is usually came or maybe a sold during 90 days.

      By maillot de foot pas cher way of Maglie Poco Prezzo writing your company's offer, You are investing buy this valuable equipment from the vendor if you're successful prospective buyer. You Maillot De Foot Pas Cher read and consent to the worldwide hummel trikots transport device fine prints clears in a replacement display maybe loss. Signific expenses previous quotation tend to cause to undergo change should improve you the highest juegos de futbol wager range..

      Through process of presenting the say, You are maillot de foot personnalise investing in buy the following supplement from the amazon müller trikot owner if you're the outstanding prospective buyer. You read and accept the worldwide supply system finer points starts up in dfb trikot müller any kind of time frame or simply tabs. manuel neuer trikot rot Scan debts years ago quotation have been short sale change must heighten Maglie Calcio Poco Prezzo you the optimum buy money.

    12. Business loans are a one of a kind subsidizing technique. It's a buy of future Mastercard deals, not an advance, so we need to utilize particular dialect steady with buy of future Visa deals, similar to payback rate and rebate rate rather than normally utilized financing cost on bank credits. Cash Advances Chicago

    13. If you have a history of illness that is difficult to recover, maybe our next article will help you to recover

      Walatra Berry Jus
      Walatra sehat mata
      Qnc jelly gamat
      Obat Kutil Kelamin Pada Pria & Wanita
      Obat Infeksi Jamur Di Selangkangan

    14. It is a time consuming process to locate a legitimate, high-quality designer Michael Kors Handbags On Sale at a decent price. One brand name that is sought after is the Michael Kors Bags On Sale. Anywhere you see high demand you will find people out to make a quick buck.

    15. It is a time consuming process to locate a legitimate, high-quality designer Michael Kors Handbags Clearance at a decent price. One brand name that is sought after is the Michael Kors Outlet Store. Anywhere you see high demand you will find people out to make a quick buck.

    16. There are those who want to collect vintage items like Michael Kors Factory Outlet with genuine and high quality leathers from Michael Kors. To be able to grab a quality Michael Kors Bags Outlet item of your choice, make sure to be very careful in selecting what to buy, how to buy and where to buy the Michael Kors Outlet Online.

    17. Designer Exposure es un buen lugar para comprar su Bolsos Michael Kors original.
      The Woven Tote es también una selección impresionante en el Bolsos Michael Kors Baratos.
      Bolso de alta calidad que debe contemplar absolutamente un Bolsos Michael Kors Outlet.
      Du kommer att upptäcka en handfull detaljer som du kan förvänta dig att komma över på en vanlig Michael Kors Rea.
      Du kan hitta ett antal platser som ger Väska Michael Kors.
      Sortimentet är fantastiskt för alla som letar efter en MK Väska.
      Håll dina ögon öppna för den här säsongens val som kommer att presenteras under bara några månader och det kommer utan tvekan att bli spektakulärt.

    18. Both things are possible if you carry Michael Kors Handbags Wholesale. If you are a woman who goes for innovative designs, a designer Michael Kors Bags On Sale is perfect for you. Offering a huge selection of chic purses, handbags, shoes and accessories, Michael Kors Outlet Online Store celebrates womanhood in an entirely unique way. Michael Kors Factory Outlet Online Store At Wholesale Price are one of the most sought-after handbags worldwide. We all agree that diamonds are a woman's best friend; however Official Coach Factory Outlet Online are absolutely next in line. To Coach Outlet Sale aficionados, don't fret because we have great news: a discount Official Coach Outlet Online isn't hard to find. If you are a smart shopper looking for a good buy and great deals on your next handbag purchase, you can go to Official Coach Outlet Online.

      Friendly Links: Toms Shoes Womens | Toms Clearance

    19. We still don't know if there will be a WNBA season. So it was kind of risky, but on the other hand I also felt that I was ready to leave and this was part of being a professional and if it's during these times and these uncertainties, I will experience them now as a professional."I still feel ready to take the challenge and accept it as it is, but I also know I can still do some things such as working out and staying in shape, the same things that I would do if I would be in college. I had the luxury of having an alternative decision of returning back to college and I didn't take it because ultimately I was ready for a new step and a new challenge."Sabally originally announced her decision to forgo her senior season on Feb. {tag: Yeezy Boost 350 Black And White Fake}

      Jordan 1 Mid Hot Punch Black Womens, Large number of people living in and around Azadpur came to buy vegetables and fruits for their daily needs. We are allowing entry only through tokens and e passes, the distribution of which is highly regulated. But a lot of people entered the market by climbing its boundary walls; one side of the grilled fencing was also damaged because of people trying to break in, a senior officer deputed at the market said on the condition of anonymity..

      I love that it has taken over six decades for me to mature to the degree that I have started to regret the need to go out in the storm. I love that at the age of 61 I still feel the adventurous once I head out, perhaps I will never get to the point where the weather truly bothers me from start to finish, I certainly hope I don I love adventures. I love, however, that I can make an adventure of love out of almost anything, even staying in.. {tag: Raffle Yeezy Cloud White Reflective}

      Jordan Retro 11 Black Varsity Red White, Are continuing our partnership with Sunnybrook Hospital to expedite COVID 19 testing of all residents and staff within the home as a precaution. We will continue to be in contact with families directly should any residents test positive. Of COVID 19 have been reported in 112 long term care homes in Ontario, of which 66 are in Toronto.

    20. Whenever there is a refreshing Coach Bags Clearance available the hype around the world is hard to picture. When you are paying a very high price tag for your Michael Kors Purses Sale you of course want it to be of a very high quality and that is what Coach Factory Outlet Online will supply you with. And you'll also find a best Ray Ban Outlet online.

      To find out if the logo in your New Yeezys is real or not, you can go online, and see correctly just what authentic Yeezy Boost 350 logo looks like. If the Cheap Air Force Onesthat you are planning to buy has a logo, which is even slightly different then it is surely not an original one. If you're getting Cheap Jordan Shoes For Men at reasonable price,just click here.

    21. Compre documentos en línea, documentos originales y registrados.
      Acerca de Permisodeespana, algunos dicen que somos los solucionadores de problemas, mientras que otros se refieren a nosotros como vendedores de soluciones. Contamos con cientos de clientes satisfechos a nivel mundial. Hacemos documentos falsos autorizados y aprobados como Permiso de Residencia Español, DNI, Pasaporte Español y Licencia de Conducir Española. Somos los fabricantes y proveedores de primer nivel de estos documentos, reconocidos a nivel mundial.

      Comprar permiso de residencia,
      permiso de residenciareal y falso en línea,
      Compre licencia de conducir en línea,
      Compre una licencia de conducir española falsa en línea,
      Comprar tarjeta de identificación,
      Licencia de conducir real y falsa,
      Compre pasaporte real en línea,

      Visit Here fpr more information. :-
      Address: 56 Guild Street, London, EC4A 3WU (UK)
      WhatsApp: +443455280186

    22. I was wondering if you could write a little more on this subject? I’d be very thankful if you could elaborate a little bit more. Many thanks!car magazine

    23. IF you are intersted then you may like: Records daily

    24. You blog post is just completely quality and informative. Many new facts and information which I have not heard about before. Keep sharing more blog posts! DF Checking

    25. Can I trust rainierland? So, let's get the answer to this question together.On the other hand, Online movies watching website Rainierland, ...

    26. This court vacated the judgment of the Superior Court in favor of the town and remanded the case to the Superior Court Cheap Real Yeezysfor the entry of an order denying the stay application and directing the parties to proceed to arbitration. Bedford v. AFSCME Council 93, Local 1703, 69 Mass. Saved us with that play, Giants manager Bruce home Bochy said. Ball gets through, it first and third and (closer Will Smith) is in a tough spot there. Game saving play. For the most part, the old hits such as The Cave sounded reassuringly familiar: hushed verses, barbershop harmonies and epic crescendos. For Dust Bowl Dance, however, the band added a layer of bombast to this gothic piano ballad, with thrashing guitars transforming it into something more primeval. The least rock'n'roll frontman in rock, Marcus Mumford, took this as an opportunity to trash the drum kit while pyrotechnics lit up the stage.. The leather sofa is Restoration Hardware's classic Lancaster model, which Huber notes has gotten better with age and use. When Maddy asks what "durable" means, Huber laughs. "It means it's sturdy.. While many people are still prosecuted under the Vagrancy Act, its use since 2010 has fallen overall as the police have other, more modern, weapons in their arsenal. These include the so called Community Protection Notices (carrying a maximum 20,000 penalty), Public Space Protection Orders (involving 100 fines, escalating to prosecutions) and Anti Social Behaviour Orders that are available for use under civil, rather than criminal, law. Some rough sleepers have even been searched under anti Terrorism legislation, underscoring how all such laws are ultimately targeted against the working class..