Solved

PowerShell Script to stop and disable services

Posted on 2016-09-09
1
58 Views
Last Modified: 2016-09-18
Does anyone have a PowerShell script to stop and disable services on a specific server?
0
Comment
Question by:amazon4life
1 Comment
 
LVL 40

Accepted Solution

by:
Subsun earned 500 total points
ID: 41791871
Try this..
Import-CSV C:\Temp\input.csv | % {
$service = Get-WmiObject win32_service -computername $_.Server -filter "name='$($_.service)'"
$service.stopservice() | Out-Null
$service.ChangeStartMode("Disabled") | Out-Null
}

Open in new window

Sample input file..
Server,service
ServerA,Spooler
ServerB,WinRM

Open in new window

1

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
Synchronize a new Active Directory domain with an existing Office 365 tenant
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

803 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