Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 160
  • Last Modified:

Services and scripts with task

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
Indyrb
Asked:
Indyrb
1 Solution
 
Will SzymkowskiSenior Solution ArchitectCommented:
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
 
IndyrbAuthor Commented:
thanks for the info, I will close this request and test it out. I appreciate the feedback and info.
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now