premise: in our domain environment, assign the Administrator level two account (User0,user1).
Requirement: Only one account is allowed to run the process "WindowsFormsApplication1":
1,) when the "WindowsFormsApplication1" is already running and the account is not your own, you need to indicate to whom the process is occupied;
2,) when "WindowsFormsApplication1" is already running and the account is running, it is necessary to indicate that the process is occupied by itself;
Problem:
When I run the change account with User0, when using [code Code-00], if the program is not enabled, it is not right-click on the administrator to start the code:
Managementbaseobject outparameters = disk. InvokeMethod ("GetOwner", inparameters,null);
The row throws an exception, saying that the permissions are insufficient.
Workaround:
We still need to add "application Manifest file" files to the project and configure the application to start with the Administrator role account.
[Code Code-00]:
Continue "C # to start WinForm as an administrator and then use the Administrator to control Windows Service"