using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SqlServer.Management.Smo;
using Microsoft.SqlServer.Management.Smo.Wmi;

namespace WMINetwork
{
    class Program
    {
        static void Main(string[] args)
        {
            // Set the authentication mode using SMO

            Server s = new Server();
            Console.WriteLine(s.Settings.LoginMode);
            s.Settings.LoginMode = ServerLoginMode.Mixed;
            s.Settings.Alter();
           
            ManagedComputer m = new ManagedComputer();

            for (int i = 0; i < m.Services.Count;i++ )
            {
                if (m.Services[i].Name == "MSSQLSERVER")
                {
                    for (int j = 0; j < m.Services[i].Properties.Count;j++)
                        Console.WriteLine(m.Services[i].Properties[j].Name);

                    for (int j = 0; j < m.Services[i].AdvancedProperties.Count;j++)
                        Console.WriteLine(m.Services[i].AdvancedProperties[j].Name);

                    Console.WriteLine(m.Services[i].Properties.Count);
                    Console.WriteLine(m.Services[i].AdvancedProperties.Count);
                }

            }
           
        }
    }
}
