Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to issue the following command remotely:

netstat -ano > C:\output.txt

but cannot figure out how to do that with WMIC! Any idea?

I've got:

process call create netstat.exe 

working but I cannot figure out how to pass the -ANO nor the output. Help please :)

share|improve this question

When issuing remote commands, quote the entire string to execute, like:

wmic /node:remote_computer process call create "netstat.exe -ano > C:\output.txt"
share|improve this answer
    
You probably need to add a /output:stdout because it does not do this by default if you want the file on the remote computer (that is ambiguous in your question), or it will be a useless output file. It took me a long time with wmic to figure that out. – songei2f Sep 23 '11 at 8:00
    
To add to the question, id like the output to be redirected to the remote machine (the issuer). Thanks! – coddrego Sep 23 '11 at 15:29
wmic /node:remote_computer process call create "cmd /c \"pushd \\remote_server\c$ && netstat -nao > n.txt && popd\""
share|improve this answer
3  
This answer is not very useful without an explanation of what it is doing. – kasperd Mar 17 '15 at 13:52

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.