Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add rollback of "automatic retry on timeout" in winrm when executing the post reboot script. This should fix the hang reported during sysprep.
  • Loading branch information
sneal committed Jun 25, 2024
1 parent 72bb051 commit 724200c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion remotemanager/winrm_clientfactory.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit 724200c

Please sign in to comment.