Jump to content

pstools - output into notepad question


Recommended Posts

Hi there, wonder if you can help. Creating a basic Gui with buttons for PStools commands inlcuding input box for remote hostname. The exe's are sitting on a remote location

I am trying to get just the "result" of a pstools command to output in two ways:

1) Pop open the output of PSInfo in a text file once the output has completed.

2) Pop open the output in a seperate DOS window.

Heres what I got so far:

<autoit>

Case $msg = $Button_2

rc = _RunDos('\\ApplicationServer\c$\TEMP\PSTools\psinfo \\' & GUICtrlRead($Input) & '>>c:\result.txt')

sleep (5)

run ("notepad.exe c:\results.txt")

<autoit/>

In the above example - button2 runs PS info successfully on the remote hostname (thats input by the user in the $input box). I have given a wait of around 5 seconds for the command to successfully complete and input the data into the text file so the text file launches. However, on some PC,s the wait can be 1 seconds and others it can be 10 seconds. I was wondering if its possibly to specify that the results.txt file opens ONLY when the command as run properly and populated the file with the result?

In the second case I had:

<autoit>

$iPID = Run('cmd.exe')

WinWaitActive("")

send ("color 0a {ENTER}")

send ("c: {ENTER}")

send ("cd winnt\system32 {ENTER}")

Send('\\ApplicationServer\c$\TEMP\PSTools\psinfo \\' & GUICtrlRead($Input) & ' {ENTER}')

<autoit/)

This successfully brings up the DOS window showing you the output of the PSInfo command. Its just like manually typing it in yourself. However, I dont want the end user to see the initial stage of the command - just want them to see the OUTPUT of the command in a seperate DOS window. Is there a way of doing this?

I tried using the Run ("\\ApplicationServer\c$\TEMP\PSTools\psinfo.exe") but had trouble in getting the $input section to interact with this...also the DOS window would just pop up and disappear.

Appreciate any help with this

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...