diff --git a/pkg/hostman/guestfs/fsdriver/windows.go b/pkg/hostman/guestfs/fsdriver/windows.go index 196c4be623..81633dc54a 100644 --- a/pkg/hostman/guestfs/fsdriver/windows.go +++ b/pkg/hostman/guestfs/fsdriver/windows.go @@ -595,7 +595,7 @@ func (w *SWindowsRootFs) DeployTelegraf(config string) (bool, error) { strings.Join([]string{ `%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe`, ` -executionpolicy bypass %SystemRoot%\telegraf.ps1`, - fmt.Sprintf(" '%s' '%s' %s", telegrafBinaryPath, telegrafConfPath, w.guestDebugLogPath), + fmt.Sprintf(" '%s' '%s' >> %s_telegraf", telegrafBinaryPath, telegrafConfPath, w.guestDebugLogPath), }, ""), `del %SystemRoot%\telegraf.ps1`, w.MakeGuestDebugCmd("setup telegraf step 2"), diff --git a/pkg/hostman/guestfs/fsdriver/winscripts.go b/pkg/hostman/guestfs/fsdriver/winscripts.go index 022996cb4a..a9d560d479 100644 --- a/pkg/hostman/guestfs/fsdriver/winscripts.go +++ b/pkg/hostman/guestfs/fsdriver/winscripts.go @@ -522,14 +522,8 @@ mtw_main(); const winTelegrafSetupPowerShellScript = ` $telegraf = $args[0] $telegraf_conf = $args[1] -$logpath = $args[2] -if ($logpath) { - & $telegraf --service install --config $telegraf_conf 2>&1 | Out-File $logpath -Append -Encoding Default - net start telegraf | Out-File $logpath -Append -Encoding Default -} else { - & $telegraf --service install --config $telegraf_conf 2>&1 - net start telegraf -} +& $telegraf --service install --config $telegraf_conf +net start telegraf `