Hey guys,
for some reason when I run this command with run as in autoit it returns access is denied. but when I run the same thing in an elevated command shell it works fine. Im not sure where I am messing up.
global $rtech,$rcred, $IP
$rtech = inputbox("","username")
$rcred = InputBox("","password")
$ip = inputbox("","enter IP")
$pid = Runas ($rtech,"mhs", $rcred, 2 ,@ComSpec & ' /c reg query \\' & $ip & '"\hklm\software\microsoft\windows\currentversion\group policy\state\machine"|findstr /i "disting"', @SystemDir, @SW_hide, $STDERR_CHILD + $STDOUT_CHILD)
Local $line
While 1
$line &= StdoutRead($pid)
If @error Then ExitLoop
WEnd
While 1
$line &= StderrRead($pid)
If @error Then ExitLoop
WEnd
MsgBox(0, "", $line)