The conditions are - I don't have administrator privilege - I want to see the status of a service in remote machine (server)
I use the following code (vb.net with framework 2.0) to see the status
Dim sqlSvc As ServiceController
Svc = New ServiceController(My.Settings.serviceName, My.Settings.machineName)
If sqlSvc.Status.ToString.Equals("Running") Then
displayStatus("success", sqlSvc.Status.ToString)
Else
displayStatus("error", sqlSvc.Status.ToString)
End If
When running the code, InvalidOperationException
is raised and found out that I need admin right in the server.
Can I lookup the status of the service without having admin right in remote machine ?
You don't have to be admin on remote machine, but you do need at least SERVICE_QUERY_STATUS permission on the particular service you want to monitor. The local Administrators group has this, as does Power Users. Or you can create a group and grant it the permission with subinacl.exe or Security Templates