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