Hi, I want to create a windowsform c# to restart remotely service from non admin poste I have always access denied
Hi, I want to create a windowsform c# to restart remotely service from non admin poste I have always access denied
I'm assuming you're trying to call ServiceController.Restart and it's throwing an exception. This is because if you have UAC enabled for your Windows user then you'll need to run your application as an Adminstrator.
The easiest way to do that is to add an app.manifest to your project, if you right click on your project and go to "Add > New Item" then search in the top right search box for "manifest", double click the template it gives you, then in the app.manifest file it's created for you there should be a line that looks like this:
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
Change it to this, build and try and run your app again:
<requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>
Before the app runs you'll get a UAC dialog requesting administrative access, so just allow it access and then it should remember that setting and you should be able to start/stop/restart services.
8 people are following this question.
Insert a node as child ,before or after a node in nested dynamic JSON Node using C#
Visual Studio 2019: Undefined behavior in a C++/CLI wrapper project.
Example for how to get Package Metadata from Azure DevOps Rest-Api Artifacts using c#
How to collapse individual nested grids/stackpanels inside a grid?