Hey Scripting Experts!
I’m trying my 1st script out, well my 1st that I’m trying to write where I haven’t found something online to put it together with. I did find information on how to disable services, but I can’t find anything to do this for multiple services across multiple servers.
Not all of the servers will have all of the services. I want to try to get some “results” logged if possible.
Here is what I have to disable the multiple services, but how can I do this remotely and on multiple servers, either 1 server at a time or in parallel?
$ListOfServices = Get-Content E:\Powershellscripts\DisableTheseServices.txt
foreach ($service in $ListOfServices)
{
Set-Service -Name $service -StartupType Disabled
Stop-Service -Name $service –Force
Get-WmiObject Win32_Service |Where-Object {$_.name -eq $Service} | Format-List -Property Name,Startmode,State
}