Solved

Services and scripts with task

Posted on 2015-01-13
2
114 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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

"Migrate" an SMTP relay receive connector to a new server using info from an old server.
A safe way to clean winsxs folder from your windows server 2008 R2 editions
This tutorial will show how to push an installation of Backup Exec to an additional server in both 2012 and 2014 versions of the software. Click on the Backup Exec button in the upper left corner. From here, select Installation and Licensing, then I…
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…

810 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