Jump to content

Running System Exec vi as Administrator in Win7


Recommended Posts

OK, Wiki sounds like a good idea.

I am also experimenting with a .NET assembly to perform the same task as the System_Exec.vi. I think I may be able to write .NET code that will allow Win7 application control to maintain higher User Level Security and still Start and Stop my desired local service.

Link to comment

OK, Wiki sounds like a good idea.

I am also experimenting with a .NET assembly to perform the same task as the System_Exec.vi. I think I may be able to write .NET code that will allow Win7 application control to maintain higher User Level Security and still Start and Stop my desired local service.

I believe that in order to start and stop a service you need to have administration privileges in Windows 2000 higher. Windows Vista and higher might even require specifically elevated privileges that an administrator account doesn't automatically grant to an executable, but requires an additional explicit User Authentification as administrator.

It would be strange that CMD.EXE itself is requiring elevated privileges but it is the service manager start and stop command you try to execute in CMD.EXE that is barking on the to low privileges you have as normal user. .Net can't circumvent the privilege level control for the service control manager but it might have extra support to allow temporary privilege elevation for the current executable for execution of service control manager commands which would require at least the according admin login credentials somehow (and if they care about security it won't be a programmatic login but an interactive login).

Link to comment

I believe that in order to start and stop a service you need to have administration privileges in Windows 2000 higher. Windows Vista and higher might even require specifically elevated privileges that an administrator account doesn't automatically grant to an executable, but requires an additional explicit User Authentification as administrator.

It would be strange that CMD.EXE itself is requiring elevated privileges but it is the service manager start and stop command you try to execute in CMD.EXE that is barking on the to low privileges you have as normal user. .Net can't circumvent the privilege level control for the service control manager but it might have extra support to allow temporary privilege elevation for the current executable for execution of service control manager commands which would require at least the according admin login credentials somehow (and if they care about security it won't be a programmatic login but an interactive login).

You are correct, higher administrative privileges are needed to control services. I have found that the .NET architecture is more flexible than simply using System_Exec.vi with string commands and therefore I will be pursuing the .NET method to handle querying, starting, and stopping my local services. However, I will have to talk with the system owner regarding the removing the User Access Control level that prevents interaction at the service level. I am fortunate to have a number of in-house resources to offer expert advice on .NET coding and will share my findings with the LAVA community.

Link to comment

OK... I got intrigued by this whilst waiting for an installer test to finish running and came up with a little something that works:

post-9667-126635704751_thumb.png

Hope this helps,

Shaun smile.gif

Thanks for the code snipet, Shaun. I did try out your method and had a User Account Control popup appear. I did some futher MSDN reading and it looks like via impersonation I may be able to run my administrator account elevated so as to not need to acknowledge the UAC popup. This system will be used without a monitor and will not have user interaction. I need to keep standard permissions on the box because the system will be on a network and I want to limit people running scripts that could affect system operation.

I will post this code as soon as I get it tested successfully. Thanks again for showing me another way to access Process Start Info processes!

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.