Skip to content

Commit 3e0d276

Browse files
Stop core plugin and agent manager in sysprep (#274)
1 parent f466588 commit 3e0d276

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

sysprep/sysprep.ps1

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ $script:sysprep_tag = 'C:\Windows\System32\Sysprep\Sysprep_succeeded.tag'
8282
$script:setupscripts_dir_loc = "$env:WinDir\Setup\Scripts"
8383
$script:setupcomplete_loc = "$script:setupscripts_dir_loc\SetupComplete.cmd"
8484
$script:sysprep_output_file_loc = "C:\Windows\System32\Sysprep\Panther\setupact.log"
85+
$script:ggactl = "$gce_install_dir\agent\ggactl_plugin.exe"
8586

8687
# Check if the help parameter was called.
8788
if ($help) {
@@ -233,7 +234,13 @@ try {
233234
}
234235

235236
Write-Log 'Stopping GCEAgent.'
236-
Stop-Service -name GCEAgent
237+
Stop-Service -name GCEAgent -ErrorAction SilentlyContinue
238+
Write-Log 'Stopping GCEAgentManager.'
239+
Stop-Service -name GCEAgentManager -ErrorAction SilentlyContinue
240+
if (Test-Path $script:ggactl) {
241+
Write-Log 'Stopping Guest Agent CorePlugin.'
242+
& $script:ggactl coreplugin stop
243+
}
237244

238245
Write-Log 'Setting startup commands.'
239246
Set-ItemProperty -Path HKLM:\SYSTEM\Setup -Name CmdLine -Value "`"$PSScriptRoot\windeploy.cmd`""

0 commit comments

Comments
 (0)