Solved

PowerShell Script to stop and disable services

Posted on 2016-09-09
1
47 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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Hi all.   The other day I had to change the passwords for a bunch of users on the fly. Because they were so many, I decided to do it in an automated way and I would like to share it with you all.   If you are not doing it directly in a Domain Co…
Microsoft Windows Server Update Service (WSUS) is free for everyone, but it lacks of some desirable features like send an e-mail to the administrator with the status of all computers on the WSUS server. This article is based on my PowerShell script …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

747 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

9 Experts available now in Live!

Get 1:1 Help Now