Sign in to follow this  
Followers 0
J03Z

Syntax help

4 posts in this topic

Hey,

I need a little direction with syntax. I am writting a script that basically connects to a remote computer and retrieves the currently logged in user of that computer and returns that output to a label.

Example.

_SET()
$inputText = GUICtrlRead($InputData)
    $Set = True
$PID = run(@ComSpec & " /c psloggedon.exe \\" & $inputText,@WorkingDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
$line = stdoutRead($PID)
ConsoleWrite($line & @CRLF)

For some reason I am not able to pull down the information. I can type the command "psloggedon \\computername" in a normal command prompt and see the currently logged on user.

Its my understanding that the @comSpec is an autoit command line interperter ?. I have read through the forum and help document and I guess I just need a little more direction around this information. Any help would be greatly appreciated.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I can't help you regarding @ComSpec but you can try this...

$logfile = "C:\t.txt" 
run(@ComSpec & " /c psloggedon.exe \\" & $inputText & " > " & $logfile) 
$fOpen = FileOpen($logfile, 0) 
$result = FileRead($fOpen) 
ConsoleWrite($result)
Edited by Steveiwonder

They call me MrRegExpMan

Share this post


Link to post
Share on other sites

Try something like this:

#include <Constants.au3>

$inputText = InputBox("Enter Client","Enter Client")
if @error then Exit

$PID = run(@ComSpec & " /c psloggedon.exe \\" & $inputText,@WorkingDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)

$line = ""
While 1
    $line &= StdoutRead($PID)
    If @error Then ExitLoop
Wend

MsgBox(0,"Logged in user","Logged in user on" & @crlf & $inputText & @crlf & "is" & @crlf & $line)
ConsoleWrite($line & @CRLF)

Share this post


Link to post
Share on other sites

Thanks guys for all the help!!! I was able to get the major problem resolved.. just a few minor things I will reasearch. Thanks once again.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0