From c107756bd5325f15018243a097488e0725464144 Mon Sep 17 00:00:00 2001 From: Yorick Barbanneau Date: Sun, 1 Apr 2018 00:07:42 +0200 Subject: [PATCH 1/2] Rework DisableService() : write UserFlagService reg key even although service could not be disable --- cleanW10.ps1 | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/cleanW10.ps1 b/cleanW10.ps1 index b2eb039..aa8a212 100755 --- a/cleanW10.ps1 +++ b/cleanW10.ps1 @@ -457,7 +457,14 @@ function DisableService { } Stop-Service -InputObject $service -PassThru | Set-Service -StartupType disabled Write-Host -ForegroundColor Green "done" - if ( $params.userService ) { + } + catch { + Write-Host -NoNewLine -ForegroundColor Red "`tError`n`t" + write-Host -ForegroundColor DarkRed $Error[0].Exception.Message + } + finally { + Write-host "Value : $($params.userService.getType())" + if ( $params.ContainsKey('userService') -and $params.userService -eq $true ) { # For this kind of service, we need to add a key t create a user service # Where user log-in. AddRegKey @{ @@ -467,11 +474,6 @@ function DisableService { } } } - catch { - Write-Host -NoNewLine -ForegroundColor Red "`tError`n`t" - write-Host -ForegroundColor DarkRed $Error[0].Exception.Message - return - } } else { Write-Host -ForegroundColor Red "`tError : No name or file for action $($MyInvocation.MyCommand.Name)" From 068e82ef2821cb4f9bdf29e354df6638e697948e Mon Sep 17 00:00:00 2001 From: Yorick Barbanneau Date: Sun, 1 Apr 2018 00:09:40 +0200 Subject: [PATCH 2/2] userService variable use real JSON Boolean type --- modules.d/SER_Users.conf | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/modules.d/SER_Users.conf b/modules.d/SER_Users.conf index d402b34..9a14348 100644 --- a/modules.d/SER_Users.conf +++ b/modules.d/SER_Users.conf @@ -7,43 +7,43 @@ "_comment" : "Disable sync service (useful for calendars, contact, mesaging and other sync applications)", "action" : "DisableService", "name" : "OneSyncSvc", - "userService" : "True" + "userService" : true }, { "_comment" : "Disable connected user platform service", "action" : "DisableService", "name" : "CDPUserSvc", - "userService" : "True" + "userService" : true }, { "_comment" : "Disable messaging service", "action" : "DisableService", "name" : "MessagingService", - "userService" : "True" + "userService" : true }, { "_comment" : "Disable contact data service", "action" : "DisableService", "name" : "PimIndexMaintenanceSvc", - "userService" : "True" + "userService" : true }, { "_comment" : "Disable contact data service", "action" : "DisableService", "name" : "UnistoreSvc", - "userService" : "True" + "userService" : true }, { "_comment" : "Disable user data sharing service", "action" : "DisableService", "name" : "UserDataSvc", - "userService" : "True" + "userService" : true }, { "_comment" : "Disable contact data service", "action" : "DisableService", "name" : "WpnUserService", - "userService" : "True" + "userService" : true } ] }