locked
Read services from remote computer problem RRS feed

  • Question

  • I am using a service controler to check all the services from a remote computer, but I am getting an error "Cannot open Serice  Control Manager on computer 'XXXX'. This operation my require other privileges."

    code:

     

     Dim MyServices As ServiceController()
            Try
                If TextBox39.Text = "" Then
                    MyServices = ServiceController.GetServices()
                Else
                    MyServices = ServiceController.GetServices(TextBox39.Text)
                End If
                For i As Integer = 0 To MyServices.Length - 1
                    ComboBox3.Items.Add(MyServices(i).ServiceName)
                Next
            Catch ex As Exception
                ListBox3.Items.Add(ex.Message)
            End Try
    

    Can somebody help me please? I dont know where to add this privileges.

    Thursday, January 19, 2012 7:52 AM

Answers

  • Hi,

    For checking the privileges,

    1.Go to Run -> Type   \\ remote machine name

    2. Wndows will ask for the credentials needed for accessing the remote machine

    3.Enter the admin credentials(remote machine), then try to access the services on the remote machine.

    Hope it helps.

    Regards,

    A.Murugan

     

     


    If it solved your problem,Please click "Mark As Answer" on that post and "Mark as Helpful". Happy Programming!
    Saturday, January 21, 2012 5:58 AM
  • You can impersonate as the administrator using Win 32 API LogonUser along with .Net WindowsIdentity class's Impersonate  method to temporarily become the administrator. Please take a look at this web page:

    http://msdn.microsoft.com/en-us/library/system.security.principal.windowsidentity.impersonate(v=vs.71).aspx


    My blog: http://soho-hsh.blogspot.com
    Saturday, January 21, 2012 8:07 AM

All replies

  • Hi,

    First check whether you got the previleges for accessing the service on remote machine. Once you got the right previlege you can access the services on remote machine.


    If it solved your problem,Please click "Mark As Answer" on that post and "Mark as Helpful". Happy Programming!
    Friday, January 20, 2012 11:14 AM
  • where do I check these privileges?
    Friday, January 20, 2012 10:32 PM
  • Hi,

    For checking the privileges,

    1.Go to Run -> Type   \\ remote machine name

    2. Wndows will ask for the credentials needed for accessing the remote machine

    3.Enter the admin credentials(remote machine), then try to access the services on the remote machine.

    Hope it helps.

    Regards,

    A.Murugan

     

     


    If it solved your problem,Please click "Mark As Answer" on that post and "Mark as Helpful". Happy Programming!
    Saturday, January 21, 2012 5:58 AM
  • You can impersonate as the administrator using Win 32 API LogonUser along with .Net WindowsIdentity class's Impersonate  method to temporarily become the administrator. Please take a look at this web page:

    http://msdn.microsoft.com/en-us/library/system.security.principal.windowsidentity.impersonate(v=vs.71).aspx


    My blog: http://soho-hsh.blogspot.com
    Saturday, January 21, 2012 8:07 AM