Skip to content

Commit bfe468e

Browse files
Honor core plugin setting on windows package update (#576)
1 parent 4db6880 commit bfe468e

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

packaging/googet/agent_install.ps1

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ $compat_path = '"C:\Program Files\Google\Compute Engine\agent\GCEWindowsCompatMa
2727
$compat_display_name = 'Google Compute Engine Compat Manager'
2828
$compat_description = 'Google Compute Engine Compat Manager'
2929

30+
$core_enabled = "C:\ProgramData\Google\Compute Engine\google-guest-agent\core-plugin-enabled"
31+
3032
$initial_config = @'
3133
# GCE Instance Configuration
3234
@@ -102,8 +104,15 @@ try {
102104
}
103105

104106
if ($install_manager) {
105-
& sc.exe config $name start=disabled
106-
Stop-Service $name
107+
# If core plugin is disabled, honor the setting and restart non-plugin based agent.
108+
if (Get-Content -Path $core_enabled -ErrorAction SilentlyContinue | Select-String -Pattern "false" -Quiet) {
109+
Restart-Service $name -Verbose
110+
}
111+
else {
112+
& sc.exe config $name start=disabled
113+
Stop-Service $name
114+
}
115+
107116
Restart-Service $compat_manager -Verbose
108117
Restart-Service $manager_name -Verbose
109118
} else {

0 commit comments

Comments
 (0)