From 724200c466bf48f3dbebdb3266df93c25a9fda31 Mon Sep 17 00:00:00 2001 From: Shawn Neal Date: Mon, 24 Jun 2024 20:18:55 -0700 Subject: [PATCH] Issue: #27 Add rollback of "automatic retry on timeout" in winrm when executing the post reboot script. This should fix the hang reported during sysprep. --- remotemanager/winrm_clientfactory.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/remotemanager/winrm_clientfactory.go b/remotemanager/winrm_clientfactory.go index 48b7d357..07848415 100644 --- a/remotemanager/winrm_clientfactory.go +++ b/remotemanager/winrm_clientfactory.go @@ -18,6 +18,12 @@ func NewWinRmClientFactory(host, username, password string) *WinRMClientFactory func (f *WinRMClientFactory) Build(timeout time.Duration) (WinRMClient, error) { endpoint := winrm.NewEndpoint(f.host, WinRmPort, false, true, nil, nil, nil, timeout) - client, err := winrm.NewClient(endpoint, f.username, f.password) + params := winrm.NewParameters( + winrm.DefaultParameters.Timeout, + winrm.DefaultParameters.Locale, + winrm.DefaultParameters.EnvelopeSize, + ) + params.AllowTimeout = true + client, err := winrm.NewClientWithParameters(endpoint, f.username, f.password, params) return client, err }