Guest User

Untitled

a guest
Nov 22nd, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. Dim listaSvcs() As ServiceProcess.ServiceController
  2. Dim SingleSvc As Object
  3. iniservice:
  4. listaSvcs = ServiceProcess.ServiceController.GetServices
  5. Try
  6. For Each SingleSvc In listaSvcs
  7. If SingleSvc.ServiceName.IndexOf("postgresql") >= 0 And SingleSvc.StartType.ToString <> "Disabled" Then
  8. If SingleSvc.Status <> ServiceProcess.ServiceControllerStatus.Running Then
  9. 'MessageBox.Show(SingleSvc.StartType.ToString)
  10. SingleSvc.Start()
  11. GoTo iniservice
  12. End If
  13. End If
  14. Next
  15. Catch ex As Exception
  16. MessageBox.Show(ex.Message)
  17. End Try
Add Comment
Please, Sign In to add comment