hiteshluthra Posted March 24, 2011 Posted March 24, 2011 Hi all genius, Im trying to get output on GUI of command dsquery computer -name (computername to which user is logged on) local $OU = Run(@ComSpec & " /c dsquery computer -name %computerName%", @SystemDir, @SW_HIDE) but getting weird output, can you pls help
wakillon Posted March 24, 2011 Posted March 24, 2011 (edited) Try this : #include <Constants.au3> $_Pid = Run ( @ComSpec & " /c dsquery computer -name " & @ComputerName, @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD ) Global $_StderrRead='', $_StdoutRead='' While ProcessExists ( $_Pid ) $_StderrRead = StderrRead ( $_Pid ) If Not @error And $_StderrRead <> '' Then ConsoleWrite ( "STDERR read : " & $_StderrRead & @Crlf ) $_StdoutRead = StdoutRead ( $_Pid ) If Not @error And $_StdoutRead <> '' Then ConsoleWrite ( "STDOUT read : " & $_StdoutRead & @Crlf ) Wend Edit : oups i forget the flag... Edited March 25, 2011 by wakillon AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts
hiteshluthra Posted March 25, 2011 Author Posted March 25, 2011 Thanks for responding, its still not working Dim $Map,$Mac,$OU $Map=DriveMapGet("H:") $OU = Run ( @ComSpec & " /c dsquery computer -name " & @ComputerName, @SystemDir, @SW_HIDE ) $Label6 = GUICtrlCreateLabel("OU Path", 32, 360, 70, 25) GUICtrlSetFont(-1, 12, 400, 0, "Century Gothic") $Input6 = GUICtrlCreateInput($OU, 232, 360, 145, 21) Kindly see the attachment this is what the output is on GUI, m i doing something wrong ?
wakillon Posted March 25, 2011 Posted March 25, 2011 Your picture show the pid of process... What give the consolewrite of my example ? AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts
hiteshluthra Posted March 25, 2011 Author Posted March 25, 2011 your code gives /ErrorStdOut error i need to get results in GUI as a result shud be like this "CN=LD6D714BS,OU=Managed Workstations,OU=Workstations,DC=server,DC=com"
wakillon Posted March 25, 2011 Posted March 25, 2011 (edited) When i try this, i get an output in a text file, but your command parameters give nothing !Are you sure of them ? RunWait ( @ComSpec & " /c DSQuery /? >c:\output.txt", @SystemDir, @SW_HIDE ) Run ( 'notepad c:\output.txt' ) Edited March 25, 2011 by wakillon AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts
hiteshluthra Posted March 25, 2011 Author Posted March 25, 2011 i need the output of the command $OU = dsquery computer -name LD6D714BS ----->>> syntax of command needs to be corrected and needs the output on input box $Input6 = GUICtrlCreateInput($OU, 232, 360, 145, 21) Tool is fully prepared except this , pls help can we chat directly through googletalk etc. ?
wakillon Posted March 25, 2011 Posted March 25, 2011 (edited) But $OU is the pid's process, not the output !I show you 2 ways for get it, but unsuccessfully... Edited March 25, 2011 by wakillon AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts
hiteshluthra Posted March 25, 2011 Author Posted March 25, 2011 i think im not understanding what you say or im not able to get you on the point i need i need to run command something like this Run ( @ComSpec & " /c dsquery computer -name " & @ComputerName, @SystemDir, @SW_HIDE ) and output should come to GUI output should be "CN=LD6D714BS,OU=Managed Workstations,OU=Workstations,DC=server,DC=com" how to get it done ?
AdamUL Posted March 25, 2011 Posted March 25, 2011 @hiteshluthraHere you go, try this:#include <Constants.au3> $iPIDOU = Run('dsquery computer -name ' & @ComputerName, @SystemDir, @SW_HIDE, $STDOUT_CHILD) ProcessWaitClose($iPIDOU) $sOU = StringStripWS(StdoutRead($iPIDOU), 3) ;Remove leading and trailing white spaces from the output.Make sure dsquery is in your system PATH. @wakillonYou didn't put the options flags, $STDOUT_CHILD + $STDERR_CHILD or $STDERR_MERGED, at the end of your Run call in your first reply. That is why your code didn't work correctly. The DS tools, dsquery and others, are part of the Windows Server Administration Tools Pack, which you can download from Microsoft. There are versions for XP and Windows 7.Adam
hiteshluthra Posted March 25, 2011 Author Posted March 25, 2011 YES YES YES YES , you all are genius......................it did work.............i was waiting for long to work it and you made it simple i have done small mistake and you got it you are genius THanks a looooooooooooooooooooooooooooooooooooooooooooooooooootttttttttttttttttttttttttttttttttttttt for help
wakillon Posted March 25, 2011 Posted March 25, 2011 @wakillonYou didn't put the options flags, $STDOUT_CHILD + $STDERR_CHILD or $STDERR_MERGED, at the end of your Run call in your first reply. That is why your code didn't work correctly. The DS tools, dsquery and others, are part of the Windows Server Administration Tools Pack, which you can download from Microsoft. There are versions for XP and Windows 7.AdamYou're right, I put the include, but i forgot them ! AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now