2
0

Changed the services lookup to allow wildcards

This commit is contained in:
2025-02-03 09:40:54 +01:00
parent 78182802b2
commit 06adb1b55e

View File

@@ -25,11 +25,17 @@
.CHANGELOG .CHANGELOG
24-06-2022 - Initial script. 24-06-2022 - Initial script.
26-06-2022 - Added remediation to start stopped services 26-06-2022 - Added remediation to start stopped services
03-02-2025 - Changed the services lookup to allow wildcards
#> #>
#region Parameters, functions and global variables #region Parameters, functions and global variables
$VAR_Excludes = "edgeupdate","RemoteRegistry","sppsvc","MapsBroker","gupdate","TrustedInstaller" $VAR_Excludes = @("edgeupdate","RemoteRegistry","sppsvc","MapsBroker","gupdate","TrustedInstaller","GoogleUpdater*")
$Services = Get-Service | Where-Object { $_.Name -notin $VAR_Excludes -and $_.StartType -eq "Automatic" -and $_.Status -ne "Running" }
$Services = Get-Service | Where-Object {
($_.Name -notmatch ($VAR_Excludes -join "|")) -and
($_.StartType -eq "Automatic") -and
($_.Status -ne "Running")
}
#endregion #endregion
#region script #region script
if (!($Services)) { if (!($Services)) {