From f0006fa999ce2371fabcc75ce71f4a6da1a303c6 Mon Sep 17 00:00:00 2001 From: Gabe Date: Tue, 5 Aug 2025 15:59:17 +0000 Subject: [PATCH] Upload files to "Services Scripts" --- ...e - Automatic Startup Services - Start.ps1 | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 Services Scripts/Service - Automatic Startup Services - Start.ps1 diff --git a/Services Scripts/Service - Automatic Startup Services - Start.ps1 b/Services Scripts/Service - Automatic Startup Services - Start.ps1 new file mode 100644 index 0000000..f665c34 --- /dev/null +++ b/Services Scripts/Service - Automatic Startup Services - Start.ps1 @@ -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 \ No newline at end of file