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
|
@ -457,6 +457,15 @@ function DisableService {
|
|||
}
|
||||
Stop-Service -InputObject $service -PassThru | Set-Service -StartupType disabled
|
||||
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 {
|
||||
Write-Host -NoNewLine -ForegroundColor Red "`tError`n`t"
|
||||
|
|
Reference in a new issue