Upload files to "Services Scripts"

This commit is contained in:
2025-08-05 15:59:17 +00:00
parent 8d50c5ddfc
commit f0006fa999
@@ -0,0 +1,39 @@
<#
Author: Gabe Kerntke
Date: 05-15-2025
.Synopsis
Script checks for any stopped services that have a startup type of automatic, it then proceeds to start said service and loops 3 times
.Modified
2025-05-15 (GabeK) - Original script created
#>
#Region Variables
$ServiceName_0 = "MapsBroker"
$ServiceName_1 = "edgeupdate"
$ServiceName_2 = "sppsvc"
$ServiceName_3 = "RemoteRegistry"
$ServiceName_4 = "WbioSrvc"
$Excluded_Services = Get-Variable -Name "ServiceName_[0-4]*" | Select-Object -ExpandProperty Value
#Region Functions
Function Start-Services {
foreach ($Service in $Stopped_Services) {
Start-Service $Service -ErrorAction SilentlyContinue | Out-Null
Start-Sleep 3
}
}
Function Read-Services_Loop {
for ($i = 0; $i -lt 3; $i++) {
$Stopped_Services = Get-Service -Exclude $Excluded_Services | Where-Object { $_.StartType -eq "Automatic" -and $_.Status -eq "Stopped" }
Start-Services
}
}
#Region Script Start
Read-Services_Loop
Write-Host "Remaining stopped services:"
Get-Service -Exclude $Excluded_Services | Where-Object { $_.StartType -eq "Automatic" -and $_.Status -eq "Stopped" } | Select-Object Status, DisplayName | Format-List
#Region Script End