Closed mwrock closed 8 years ago
Exitcode issue is resolved.
The runner is now a Shell
and can be used like:
conn.shell(:elevated) do |shell|
shell.username = 'System'
shell.password = nil
shell.run('$PSVersionTable') do |stdout, stderr|
STDOUT.print stdout
STDERR.print stderr
end
end
This is work to get winrm-elevated working with new PSRP implementation. This initial port does not change any external interfaces other than the fact that the runner now takes a shell instead of an executor.
It is working with the exception of the exit code which seems to come over as 0 regardless of
$LASTEXITCODE
in the script.Beyond fixing exit code, I'd like to change the interface so that runner actually IS a
Shell
. Assuming you require winrm-elevatedWinRM::Connection.Shell(:elevated_powershell)
will return a shell that implementsrun
via a task and uses the username and password of the connection.Alternatively you could "new up" a elevated shell with alternate credentials.