I agree with Andreas's comment: "Please don't expect a ready to go script based on your individual requirements."
Having said that, I have a script that I believe that I already shared with another user, that you might be able to use. I have not been able to find that forum thread, so here is the script.
Note that in my testing on Win10 machines, I have found that KB5001649 appears to greatly affect the processing time of $service.StartType when run against remote machines. If you experience the same problem, then you may need to modify the script to do an Invoke-Command instead of specifying the computer name on the Get-Service cmdlet. You may also need to modify the testing of service status and starttype to suit your needs.
# Script to start services that are set to start automatically, but are not running.
# Author: Dave K. (MotoX80 on MS forums) @GenuineMadware
# KB5001649 appears to greatly affect the processing time of $service.StartType
$AllServers = Get-Content c:\temp\serverlist.txt
$Report = @()
""
"All services on all servers"
foreach ($server in $AllServers) {
"Analyzing {0}" -f $server
$AllServices = $null
$AllServices = Get-Service -ComputerName $server
"Found {0} services." -f $AllServices.count
foreach ($service in $AllServices) {
#$service.Name
$report += [PSCustomObject]@{
ComputerName = $server
ServiceName = $service.name
Start = $service.StartType
Status = $service.Status
}
}
}
"Total service count is {0}" -f $report.Count
$report | Format-Table
$failures = $report | Where-Object -Property start -eq Automatic | Where-Object -Property Status -eq Stopped
""
"These services set to start automatically but are not running."
$failures | Format-Table
""
"Restarting non-excluded failed services."
$exclude = @('MapsBroker','debugregsvc','sppsvc','isahelpersvc','gpsvc','gupdate','lltdsvc','edgeupdate')
foreach ($service in $failures) {
if ($exclude -notContains $service.ServiceName) {
"Starting {0} on {1}" -f $service.ServiceName , $service.ComputerName
Set-Service -Name $service.ServiceName -computername $service.ComputerName -Status Running
}
}