Link to home
Start Free TrialLog in
Avatar of kd36939
kd36939Flag for United States of America

asked on

Restarting a service in a non-admin account

We use location based printing in our VDI environment. However, the printers disappear for random users and the only way to get the printers back is to restart the "TP AutoConnect Service" . The users does not have admin rights on their machine, so the  way you restart the service is to VNC in their VDI, run services.msc as an admin user and restart the service.

But this process is not efficient.

I want a way where a script runs in the background and restarts the service every two hours or so without the users knowledge. The script should not prompt the user for any username or password.  Probably a scheduled task?

Can the scripting gurus help me with it?

Thank you in advance.
SOLUTION
Avatar of Qlemo
Qlemo
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of happydude3
happydude3

The final method for assigning rights to manage services is to use the Subinacl.exe utility from the Windows 2000 Resource Kit. The syntax for this is:
SUBINACL /SERVICE \\MachineName\ServiceName /GRANT=[DomainName\]UserName[=Access]
Notes

The user executing this command must have administrator rights in order for it to complete successfully.
If "MachineName" is omitted, the local machine is assumed.
If "DomainName" is omitted, the local machine is searched for the account.
Although the syntax example indicates a user name, this will work for user groups as well.
The values that 'Access' can take are:
   F : Full Control
   R : Generic Read
   W : Generic Write
   X : Generic eXecute
   L : Read controL
   Q : Query Service Configuration
   S : Query Service Status
   E : Enumerate Dependent Services
   C : Service Change Configuration
   T : Start Service
   O : Stop Service
   P : Pause/Continue Service
   I : Interrogate Service
   U : Service User-Defined Control Commands
                              
If 'Access' is omitted then 'F (Full Control)' is assumed.
Subinacl supports similar functionality in relation to files, folders, and registry keys. Refer to the Windows 2000 Resource Kit for more information.
The service name should be the "short name," as used for the service-specific key in the registry:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\<ServiceName>
If the service name contains spaces, the whole parameter should be enclosed in quotation marks. For example:
"\\MachineName\Service Name With Spaces"

http://www.microsoft.com/en-us/download/details.aspx?id=23510
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial