Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8837469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:43:57+00:00 2026-06-14T09:43:57+00:00

I am trying to write a little console app to display a list of

  • 0

I am trying to write a little console app to display a list of running Service Applications on a SharePoint 2010 site. I have employed Microsoft.SharePoint as well as Microsoft.SharePoint.Administration, but so far I am not having much luck. Below is what I have been fiddling around with. Can anyone give me some pointers on how to properly use SPServiceApplicationCollection?

Thanks in advance!

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.ServiceProcess;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;

namespace ConsoleApplication1
{
class Program
{
    static void Main(string[] args)
    {

        SPServiceApplicationCollection services = new      SPServiceApplicationCollection(String, SPFarm.Local.Services);
        foreach (SPServiceApplication service in services)
        {
            Console.WriteLine(service.Name);

            if (service is SPWebService)
            {
                SPWebService webService = (SPWebService)service;

                foreach (SPWebApplication webApp in webService.WebApplications)
                {
                    Console.WriteLine(webApp.Name);
                    Console.ReadLine();
                }

            }

        }
    }
}
}

EDIT
After some digging/asking around I came up with a rough solution of what I wanted.
For future reference/anyone else that wishes to do this sort of thing, I was able to get a list of deployed servers as well as the application name by doing the following:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.ComponentModel;
    using System.ServiceProcess;
    using Microsoft.SharePoint;
    using Microsoft.SharePoint.Administration;
    using Microsoft.SharePoint.Administration.Health;

    namespace ConsoleApplication1
    {
    class Program
    {
    static void Main(string[] args)
    {
        var solution = SPFarm.Local.Solutions["Your Service Application Name.wsp"];
        string serverName = string.Empty;
        foreach (SPServer server in solution.DeployedServers)
        {
            serverName += server.Name;
            Console.WriteLine(server.Name);
        }

        if (solution != null)
        {
            if (solution.Deployed)
            {
                Console.WriteLine("{0} is currently deployed on: {1}", solution.Name, serverName);
                Console.ReadLine();
            }
            else
            {
                Console.WriteLine("Error!  Solution not deployed!");
                Console.ReadLine();
            }
        }

    }
}
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T09:43:58+00:00Added an answer on June 14, 2026 at 9:43 am

    After some digging/asking around I came up with a rough solution of what I wanted. For future reference/anyone else that wishes to do this sort of thing, I was able to get a list of deployed servers as well as the application name by doing the following:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.ComponentModel;
    using System.ServiceProcess;
    using Microsoft.SharePoint;
    using Microsoft.SharePoint.Administration;
    using Microsoft.SharePoint.Administration.Health;
    
    namespace ConsoleApplication1
    {
    class Program
    {
    static void Main(string[] args)
    {
        var solution = SPFarm.Local.Solutions["Your Service Application Name.wsp"];
        string serverName = string.Empty;
        foreach (SPServer server in solution.DeployedServers)
        {
            serverName += server.Name;
            Console.WriteLine(server.Name);
        }
    
        if (solution != null)
        {
            if (solution.Deployed)
            {
                Console.WriteLine("{0} is currently deployed on: {1}", solution.Name, serverName);
                Console.ReadLine();
            }
            else
            {
                Console.WriteLine("Error!  Solution not deployed!");
                Console.ReadLine();
            }
        }
      }
     }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to write app for service technicians that will display open service calls within
I'm new to objective-c and Im trying to write a little sample app that
I'm trying to write a little app to capture keystrokes for a window under
I'm trying to write a little Messagecenter for my Project. The problem I'm running
I'm trying to write a little greasemonkey script/bookmarklet/what have you for Google Docs. The
I'm trying to write a little SQL Helper. I have a query like this
I am trying to write a little application to display the most recent tweet
I'm trying to write a little Emacs Lisp script that reads a csv file
I'm trying to write a little helper for Windows which eventually will accept a
I'm trying to write a little piece of code to show in a portlet

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.