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.
Windows 7PowershellVMware

Avatar of undefined
Last Comment
Prashant Girennavar
SOLUTION
Avatar of Qlemo
Qlemo
Flag of Germany image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
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
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Windows 7
Windows 7

Windows 7 is an operating system from Microsoft. Features include multi-touch support, a redesigned Windows Shell with a new taskbar, referred to as the Superbar, a home networking system called HomeGroup, and performance improvements.

48K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo