service with userService to True write a registry key to not create a user service when log-in
This commit is contained in:
parent
ae3fe95912
commit
80e3c40b43
1 changed files with 10 additions and 1 deletions
11
cleanW10.ps1
11
cleanW10.ps1
|
@ -456,7 +456,16 @@ function DisableService {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
Stop-Service -InputObject $service -PassThru | Set-Service -StartupType disabled
|
Stop-Service -InputObject $service -PassThru | Set-Service -StartupType disabled
|
||||||
Write-Host -ForegroundColor Green "done "
|
Write-Host -ForegroundColor Green "done"
|
||||||
|
if ( $params.userService ) {
|
||||||
|
# For this kind of service, we need to add a key t create a user service
|
||||||
|
# Where user log-in.
|
||||||
|
AddRegKey @{
|
||||||
|
path="HKLM:\SYSTEM\CurrentControlSet\Services\$($params.name)";
|
||||||
|
key="UserServiceFlags"
|
||||||
|
value="0"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
Write-Host -NoNewLine -ForegroundColor Red "`tError`n`t"
|
Write-Host -NoNewLine -ForegroundColor Red "`tError`n`t"
|
||||||
|
|
Reference in a new issue