Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Start and Stop Service with Elevation

$
0
0

hello guys, how to start and stop a service with elevation.

got this code below but it doesn't run i suspect due to admin rights issues.

any ideas on how to make this code works?

        Dim service As ServiceController = New ServiceController("W32Time")

        If ((service.Status.Equals(ServiceControllerStatus.Stopped)) Or (service.Status.Equals(ServiceControllerStatus.StopPending))) Then

            service.Start()

        Else

            service.Stop()

        End If


Every second counts..make use of it. Disclaimer: This posting is provided AS IS with no warranties or guarantees and confers no rights.
IT Stuff Quick Bytes


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>