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.
SUBINACL /SERVICE \\MachineName\ServiceName /GRANT=[DomainName\]UserNa
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\
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