0

I want to run the sysinternals tool psloglist to get the event log of a server that is on another domain.

If I run

runas /netonly /user:DOMAIN2\USER psloglist \\TARGETSERVER 

Then a new command window appears and the I see the correct data being listed.

How can I capture this output in a file on my machine on DOMAIN1?

I tried

runas /netonly /user:DOMAIN2\USER psloglist \\TARGETSERVER > event.log

Which captured the runas password prompt.

I also tried creating a batch file with

psloglist \\TARGETSERVER > event.log

and running

runas /netonly /user:DOMAIN2\USER mybatchfile

but that instantly returns and no command window appears and no file is created.

I presume this is because DOMAIN2\USER cannot create the event.log file on my machine, how can I get around this?

DOMAIN1 has no trust with DOMAIN2 and I cannot added it.

2 Answers 2

0

Well you have two options you can either use:

runas /savecred /domain2\user xxxx xxxxx

Then enter password so it 'saves' the credentials, then run again to get output...

runas /savecred /domain2\user xxxx xxxxx > output.log

Or you use a VBS script which has the password stored as plain text within.. If this would work for you let me know and I'll knock something up however plain text passwords never a good idea...

3
  • runas will not let me use /savecred and /netuse at the same time and I can not see how to avoid using both
    – rob
    Oct 3, 2014 at 13:55
  • very true... yep runas is no good for you.. are happy with a script that contains the password?
    – CharlesH
    Oct 3, 2014 at 14:02
  • yes this is just an internal monitoring tool
    – rob
    Oct 3, 2014 at 14:14
0

Seems I missed a trick, even though all the examples for psloglist show the argument -u with just a user name it does work with a domain.

So my working solution is

psloglist \\TARGETSERVER -u DOMAIN2\USER -p PASSWORD > event.log

Note the password has to be supplied otherwise the prompt gets swallowed by the redirection.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .