How to use WMIC to connect to remote machine and output netstat to a file?
50,713
When issuing remote commands, quote the entire string to execute, like:
wmic /node:remote_computer process call create "netstat.exe -ano > C:\output.txt"
Author by
coddrego
Updated on September 18, 2022Comments
-
coddrego almost 2 years
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 :)
-
songei2f almost 13 yearsYou 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. -
coddrego almost 13 yearsTo add to the question, id like the output to be redirected to the remote machine (the issuer). Thanks!
-
kasperd over 9 yearsThis answer is not very useful without an explanation of what it is doing.
-
Patrick Mevzek over 6 yearsPlease a least give one example in your answer as text instead of just an URL.
-
Paul over 6 yearsWelcome to Server Fault! Your answer suggests a workable solution to the question is available via another website. The Stack Exchange family of Q&A websites generally frowns on this type of answer. Please read How do I write a good answer? and consider revising your answer to include the steps required to resolve the issue. And don't forget to take the site tour.