开发者

Sharepoint 2010 topology with this issue?

I have installed sharepoint 2010 farm in my organization. where machine 1 has Sql server r2, Machine 2 has Sharepoint server, Machine 3,4,5,6 has Front tier only.

I am writing the program in which i am trying to get the name of only sharepoint servers, not sql server. so i tried this line :

SPServerCollection collection = new SPServerCollection(SPFarm.Local);
                collection = SPFarm.Local.Servers;

But It should give me all servers in the farm, except Sql开发者_开发问答 server instance. how to identify the server type like ..this is sp front tier,...this is sp central administration server.. in c#. How to do this ?

Also how to get web applications in each server. ?


static void Main(string[] args)
    {
        SPFarm farm = new SPFarm();
        farm = SPFarm.Local;
        SPServerCollection myServerCollection=farm.Servers;
        foreach (SPServer myServer in  myServerCollection)
        {
            Console.WriteLine(myServer.Name + " " + myServer.Role);
        }
        Console.Read();
    }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜