don't fail if user is not logged in closes amidaware/tacticalrmm#1573
This commit is contained in:
parent
836c274e83
commit
7f9e3f0f7d
@ -161,11 +161,10 @@ func (a *Agent) RunScript(code string, shell string, args []string, timeout int,
|
|||||||
cmd := exec.Command(exe, cmdArgs...)
|
cmd := exec.Command(exe, cmdArgs...)
|
||||||
if runasuser {
|
if runasuser {
|
||||||
token, err := wintoken.GetInteractiveToken(wintoken.TokenImpersonation)
|
token, err := wintoken.GetInteractiveToken(wintoken.TokenImpersonation)
|
||||||
if err != nil {
|
if err == nil {
|
||||||
return "", err.Error(), 66, err
|
defer token.Close()
|
||||||
|
cmd.SysProcAttr = &syscall.SysProcAttr{Token: syscall.Token(token.Token()), HideWindow: true}
|
||||||
}
|
}
|
||||||
defer token.Close()
|
|
||||||
cmd.SysProcAttr = &syscall.SysProcAttr{Token: syscall.Token(token.Token()), HideWindow: true}
|
|
||||||
}
|
}
|
||||||
cmd.Stdout = &outb
|
cmd.Stdout = &outb
|
||||||
cmd.Stderr = &errb
|
cmd.Stderr = &errb
|
||||||
|
Loading…
Reference in New Issue
Block a user