1

This is incredibly difficult to do. I can't believe it. It should be so easy.

Anyway, using WMI (with both vbscript and perl) I'm able to start a process on a remote machine that runs a .exe, but I cannot get the output to write to a log. This is driving me nuts. I have to use WMI or powershell because I can't install anything additional on the remote machines, which are all Windows 2003 or newer. I also cannot assume that powershell remoting is enabled on all target machines, so I may not even be able to use powershell. This can cause a problem with powershell.

Here is what I'm trying to do in psuedo code:

servers = server1, server2, server3

for each server in servers

run command on remote server >> log.txt

next

1
  • are you open to VBS? I don't know PS but I think I have something for VBS using WMI as the connection mechanism. Commented Sep 20, 2012 at 7:19

1 Answer 1

1

I'm assuming you have powershell remoting enabled on all the servers and that you want the results saved in a local log file (ie not on each server)...

$Servers = "server1", "server2","server3"

Invoke-Command -ComputerName $Servers -ScriptBlock { ping.exe www.stackoverflow.com } >> c:\localfile.txt

This also assumes that your exe outputs to stdout, I think there will be issues capturing other streams.

Sign up to request clarification or add additional context in comments.

1 Comment

Unfortunately, I cannot assume that powershell remoting is enabled. I think I may need to use only WMI or WMIC.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.