ManagedComputer only has SQLBrowser service in its collection

Answered ManagedComputer only has SQLBrowser service in its collection

  • 2012년 3월 28일 수요일 오후 8:34
     
      코드 있음

    In order to pause a service I get the instant of serivce in ManagedComputer service Collection

    Service service =null;

    ManagedComputer mc = new ManagedComputer(); //

    service = mc.Services["MSSQLSERVER"]

    this works on a machine with Windows 7 64bit with SQL server 2008 Express R2 X86

    However on a machine with identical sqlserver but running winodws XP 32 bit the service collection for mc contains just SQLBROWSER service.

    I have tried giving the server name using

    ManagedComputer mc = new ManagedComputer(ComputerName)

    mc .ConnectionSettings.ProviderArchitecture = ProviderArchitecture.Use32Bit;

    But it did not help.

    Thanks

모든 응답

  • 2012년 3월 28일 수요일 오후 9:06
    중재자
     
     

    Hello,

    There is only one SQL Browser Service on a computer even if you have installed several SQL Server instances with different versions. I have not tested for SQL Server 2012.

    The executable file is in Program Files\SQL Server\90\Shared . ( 90 is usually for SQL Server 2005 but if you upgrade your 2005 to 2008, the program stays always in the same folder 90\Shared

    You have tried new ManagedComputer(ComputerName) . It is not working ( for my computer ) if the ComputerName is the name of the local computer on which you are executing your program ( i have not tested since SQL Server 2008 SP2 )

    Don't hesitate to post again for more help or explanations

    Have a nice day


    Mark Post as helpful if it provides any help.Otherwise,leave it as it is.

  • 2012년 3월 29일 목요일 오전 11:58
     
     답변됨

    Papy;

    Thank you for taking the time to respond. I am not still very clear why the Windows 7 machine has number of services in its collection but the XP has only one service SQLBROWSER. In order for my code to work I need to access MSSQLSERVER service which is not part of service collection on the XP machine.

    Is this because of way the machine name and sql server can interact with each other?

    • 답변으로 표시됨 Gene Ariani 2012년 3월 30일 금요일 오후 2:05
    •  
  • 2012년 3월 29일 목요일 오후 9:28
    중재자
     
     

    Hello,

    I would propose you this link :

    http://www.mssqltips.com/sqlservertip/2622/windows-services-for-sql-server/?utm_source=dailynewsletter&utm_medium=email&utm_content=headline&utm_campaign=2012322 

    this little article explains in a clear and simple way the services related to SQL Server

    There is a little-known  property of the Service class : Type which returns a ManagedServiceType enumeration

    http://msdn.microsoft.com/en-us/library/microsoft.sqlserver.management.smo.wmi.service.type(v=sql.110).aspx 

    and http://msdn.microsoft.com/en-us/library/microsoft.sqlserver.management.smo.wmi.managedservicetype(v=SQL.90).aspx  which gives you the possible values and explanations for ManagedServiceType. But be careful it is not always to get a correspondance between the integer value underlying a value of ManagedServiceType and the explanations for the versions before 2012.

    See http://social.msdn.microsoft.com/Forums/en-US/sqldocumentation/thread/4e9fbadf-5194-4052-8549-2be63e085fef for some explanations about this problem.

    MSSQLServer is the underlying name of the SQL Server service for a no-named instance ( since 2008, it is possible to create a no-named SQL Server Express instance, but not possible for 2005 )

    see http://social.msdn.microsoft.com/Forums/en-US/netfxbcl/thread/8b82815f-d36b-4ac1-88f2-9d4522e01623/  ( i amsorry if it is a thread where i replied in this forum but i got this thread with a Bing search about ManagedServiceType )

    I suppose that you are on a Windows domain where WMI queries are easier than on a workgroup ( i know this problem as i have a workgroup because a mix betwwen Home Windows 7 and XP Pro ). For you, it should be easier to collect informations about services on other computers.. All i know is that the creation of a new ManagedComputer with a name = name of the local computer is throwing an exception.

    I am surprised to read that your XP Pro has only one service : SQL Browser  service.

    According http://msdn.microsoft.com/en-us/library/ms181087.aspx , i found :"The SQL Server Browser service is uninstalled when the last instance of SQL Server is removed". Have you any SQL Server instances installed on your XP Pro ?

    Have a nice day


    Mark Post as helpful if it provides any help.Otherwise,leave it as it is.

  • 2012년 3월 30일 금요일 오후 2:11
     
     


    Thanks Papy
    for extended reply. As you indicated the odd things is the XP machine actually
    returns one Service and that is SQL Browser. I would understand if there was no
    service at all in the collection. One thing to mention is that the machine name
    was changed after sql server was installed. I do not know if renaming the
    machine would cascades through all sql server elements on the machine. <o:p></o:p>

    I also checked and SQl Browser on XP is running under the same account which other sql
    services are running.<o:p></o:p>

    At the end
    I ended up using ServiceCollection to get access to the sql server service.<o:p></o:p>