Jump to content

Syntax help


J03Z
 Share

Recommended Posts

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.

Link to comment
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)
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...