From 5fae7389e1bef175f8829c85e3c9b2d979c1566b Mon Sep 17 00:00:00 2001 From: r3incarnat0r <38186974+r3incarnat0r@users.noreply.github.com> Date: Tue, 18 Sep 2018 14:06:57 +0200 Subject: [PATCH] Minor changes (#133) - shortened Default.cmd - prevented annoying homegroup errors for 1803+ (counterpart for enabling not touched, cuz it's good to see the errors in this case imo) --- Default.cmd | 4 +--- Win10.psm1 | 12 ++++++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Default.cmd b/Default.cmd index feced36..6f5200e 100644 --- a/Default.cmd +++ b/Default.cmd @@ -1,3 +1 @@ -@ECHO OFF - -powershell.exe -NoProfile -ExecutionPolicy Bypass -File "%~dp0Win10.ps1" -include "%~dp0Win10.psm1" -preset "%~dpn0.preset" +@powershell.exe -NoProfile -ExecutionPolicy Bypass -File "%~dp0Win10.ps1" -include "%~dp0Win10.psm1" -preset "%~dpn0.preset" diff --git a/Win10.psm1 b/Win10.psm1 index 3770945..6814554 100644 --- a/Win10.psm1 +++ b/Win10.psm1 @@ -796,10 +796,14 @@ Function EnableUpdateRestart { # Stop and disable Home Groups services - Not applicable to 1803 and newer or Server Function DisableHomeGroups { Write-Output "Stopping and disabling Home Groups services..." - Stop-Service "HomeGroupListener" -WarningAction SilentlyContinue - Set-Service "HomeGroupListener" -StartupType Disabled - Stop-Service "HomeGroupProvider" -WarningAction SilentlyContinue - Set-Service "HomeGroupProvider" -StartupType Disabled + If (Get-Service "HomeGroupListener" -ErrorAction SilentlyContinue) { + Stop-Service "HomeGroupListener" -WarningAction SilentlyContinue + Set-Service "HomeGroupListener" -StartupType Disabled + } + If (Get-Service "HomeGroupProvider" -ErrorAction SilentlyContinue) { + Stop-Service "HomeGroupProvider" -WarningAction SilentlyContinue + Set-Service "HomeGroupProvider" -StartupType Disabled + } } # Enable and start Home Groups services - Not applicable to 1803 and newer or Server