Avatar of kd36939
kd36939
Flag 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.
Windows 7PowershellVMware

Avatar of undefined
Last Comment
Prashant Girennavar

8/22/2022 - Mon
SOLUTION
Qlemo

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
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
Prashant Girennavar

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes