Solved

stopping a service for certain amount of time at logon

Posted on 2011-09-27
13
386 Views
Last Modified: 2012-05-12
We have a piece of software that has to load before a service starts or it cant connect.

The "Delay" option on the service isnt long enough, i have tried writing a script to run at logon to stop the service then restart it after the programme has started.

However - users need admin priviledges to stop services.

Is there any other way i can accomplish this, i need it to happen each time a user logs in.

We use X, Vista and 7. With 2008 DC's
0
Comment
Question by:CaptainGiblets
  • 5
  • 4
  • 2
  • +2
13 Comments
 
LVL 8

Expert Comment

by:eXpeLLeD_4RM_heLL
ID: 36708452
Why not create a Batch file with a delay command and put it in the startup folder
0
 
LVL 6

Author Comment

by:CaptainGiblets
ID: 36708459
if its in the startup folder it wont run as an administrator though will it? Or do you mean add it to the "all users" startup folder.
0
 
LVL 8

Expert Comment

by:eXpeLLeD_4RM_heLL
ID: 36708468
In your Compatability Screen, you have the option to run the program as Administrator. Just Tick the Run as Administrator box
0
 
LVL 6

Author Comment

by:CaptainGiblets
ID: 36708477
You cant run it as an administrator without admin credentials though?
0
 
LVL 65

Assisted Solution

by:RobSampson
RobSampson earned 200 total points
ID: 36708499
I have a feeling you would have to do this by making the server Manual, and then having a scheduled that runs
net start servicename

Then, users could try running the program by running a batch file that does this:
c:\program files\yourapp\app.exe
schtasks /run /tn "StartService"

where "StartService" is the name given to the scheduled task.

I can't really think of any other way....

Regards,

Rob.
0
 
LVL 66

Expert Comment

by:johnb6767
ID: 36711138
Could create a dependency on a late starting service......

LoadOrder v1.0
http://technet.microsoft.com/en-us/sysinternals/bb897416

Or pick one of the last ones, or at least a later running Delayed Start Services perhaps?

Or create your own script to delay x amount of seconds and write a flag, and only when it sees the flag, start....... Just throwing it out there at the top of my head really....



0
Don't lose your head updating email signatures!

Do your end users still have the wrong email signature? Do email signature updates bore you or fill you with a sense of dread? You can make this a whole lot easier on yourself by trusting an Exclaimer email signature management solution. Over 50 million users do...so should you!

 
LVL 83

Accepted Solution

by:
oBdA earned 300 total points
ID: 36714587
Create a group "ManageThatService" or whatever, and delegate the Start/Stop permissions to this group. Add the users who work with the program to this group, and then use a batch script to start the program:
net stop "That Service"
start "" "T:\hat\program.exe"
net start "That Service"

Open in new window

How to grant users rights to manage services in Windows Server 2003
http://support.microsoft.com/kb/325349
0
 
LVL 6

Author Comment

by:CaptainGiblets
ID: 36716126
i managed to get this working eventually.

i just added a simple logon script that stopped the service on logon, waited 300 seconds then started it again.

However because the user is just a normal user who cant start / stop services. I this command
subinacl /service \\computername\fwcagent /grant="Everyone"=f

Now anyone can start/stop the service so the login script works as intended
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 36716159
That's very much along the lines of what oBdA suggested.  However, I'd be more inclined to go with that approach of the batch file, and make the service "Manual", because if the software shuts down for some reason, does the service need to be stopped again before the application can run?

Rob.
0
 
LVL 6

Author Comment

by:CaptainGiblets
ID: 36716187
I have put a script on each users desktop as well just in case the programme does crash. Cheers for all advice.
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 36813653
OK, so is that you all you need for this question then?
0
 
LVL 6

Author Closing Comment

by:CaptainGiblets
ID: 36813700
I have given more points to oDba as he did provide the solution i went with although i split the points with RobSampson as his ideas pushed me into the direction that helped me figure it out.
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 36813707
Thanks, glad to help.

Rob.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
You may have a outside contractor who comes in once a week or seasonal to do some work in your office but you only want to give him access to the programs and files he needs and keep privet all other documents and programs, can you do this on a loca…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now