Solved

Services and scripts with task

Posted on 2015-01-13
2
103 Views
Last Modified: 2015-01-15
I need assistance of the following

Every Friday Stop a service
Change service from automatic to manual
The service will remain stopped,
During this time specified reboots may be encountered.

Then another script that resets the service back to automatic
And reboots server

Example Friday stop.... change...   Saturday reset/start and reboot.

can be powershell, vbscript, or batch... add to task scheduler.

Thanks
0
Comment
Question by:Indyrb
2 Comments
 
LVL 53

Accepted Solution

by:
Will Szymkowski earned 500 total points
ID: 40547134
This is very easy to accomplish with powershell. 2 different commands...
Friday Code
Get-Service -Name <service name> | Stop-Service
Set-Service -Name <service name> -StartupType "Manual"

Open in new window


Saturday Code
Set-Service -Name <service name> -StartupType "automatic" | shutdown -r -t 01

Open in new window


Then create 2 scheduled tasks for each script. Set the parameters accordingly.

Program to Launch should look like below...
 Program = powershell.exe
Arguments = -file c:\scriptslocation\script.ps1

Will.
0
 

Author Comment

by:Indyrb
ID: 40551920
thanks for the info, I will close this request and test it out. I appreciate the feedback and info.
0

Featured Post

Free book by J.Peter Bruzzese, Microsoft MVP

Are you using Office 365? Trying to set up email signatures but you’re struggling with transport rules and connectors? Let renowned Microsoft MVP J.Peter Bruzzese show you how in this exclusive e-book on Office 365 email signatures. Better yet, it’s free!

Join & Write a Comment

In this previous article (https://oddytee.wordpress.com/2016/05/05/provision-new-office-365-user-and-mailbox-from-exchange-hybrid-via-powershell/), we made basic license assignments to users in O365. When I say basic, the method is the simplest way …
The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
This tutorial will walk an individual through locating and launching the BEUtility application and how to execute it on the appropriate database. Log onto the server running the Backup Exec database. In a larger environment, this would generally be …
This tutorial will give a short introduction and overview of Backup Exec 2012 and how to navigate and perform basic functions. Click on the Backup Exec button in the upper left corner. From here, are global settings for the application such as conne…

757 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

23 Experts available now in Live!

Get 1:1 Help Now