Skip to content

Commit

Permalink
windows account: ignore "user already belogs to group" error (#387)
Browse files Browse the repository at this point in the history
  • Loading branch information
dorileo authored Apr 17, 2024
1 parent 05f333e commit fe13801
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion google_guest_agent/accounts_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,14 @@ func createUser(ctx context.Context, username, pwd, _ string) error {
uintptr(unsafe.Pointer(&uInfo1)),
uintptr(0),
)
if ret != 0 {

// If Error 2236 = The user already belongs to this group.
// No action is required, see:
// https://learn.microsoft.com/en-us/troubleshoot/windows-server/remote/terminal-server-error-messages-2200-to-2299#error-2236
if ret != 0 && ret != 2236 {
return fmt.Errorf("nonzero return code from NetUserAdd: %s", syscall.Errno(ret))
}

return nil
}

Expand Down

0 comments on commit fe13801

Please sign in to comment.