使用 WMIC 到 STDOUT 的远程 Netstat?
Remote Netstat to STDOUT with WMIC?
我想使用 WMIC 检索远程计算机上 "netstat" 命令的输出。以下命令的实际执行没有错误,我在新的 window:
中看到输出弹出窗口
wmic /node:server1 process call create "netstat.exe -ano"
话虽如此,我需要将进程 window 的输出通过管道传输到 STDOUT,并尝试过:
wmic /node:server1 process call create "netstat.exe -ano > C:\temp\test.txt"
然而,那是行不通的。我也尝试过 /output:STDOUT 选项,但是,它只报告命令的执行:
Executing (Win32_Process)->Create() Method execution successful. Out Parameters: instance of __PARAMETERS {
ProcessId = 5044;
ReturnValue = 0; };
有谁知道如何使用 WMIC 从新打开的 window 中检索实际输出以处理数据?
提前致谢!
>
符号在 cmd.exe
中的行为与 operator of redirection 相同,而不是在 netstat.exe
中。
事实上,wmic process call create "netstat.exe -ano > C:\temp\test.txt"
即将 运行 与 netstat.exe -ano ^> files\nstat.txt
相同(从命令行尝试)。
下一个命令有效(不幸的是,我目前无法在远程计算机上使用 /node:"server1"
进行尝试):
wmic process call create "cmd /C > C:\temp\test.txt 2>&1 netstat.exe -ano"
我想使用 WMIC 检索远程计算机上 "netstat" 命令的输出。以下命令的实际执行没有错误,我在新的 window:
中看到输出弹出窗口wmic /node:server1 process call create "netstat.exe -ano"
话虽如此,我需要将进程 window 的输出通过管道传输到 STDOUT,并尝试过:
wmic /node:server1 process call create "netstat.exe -ano > C:\temp\test.txt"
然而,那是行不通的。我也尝试过 /output:STDOUT 选项,但是,它只报告命令的执行:
Executing (Win32_Process)->Create() Method execution successful. Out Parameters: instance of __PARAMETERS {
ProcessId = 5044;
ReturnValue = 0; };
有谁知道如何使用 WMIC 从新打开的 window 中检索实际输出以处理数据?
提前致谢!
>
符号在 cmd.exe
中的行为与 operator of redirection 相同,而不是在 netstat.exe
中。
事实上,wmic process call create "netstat.exe -ano > C:\temp\test.txt"
即将 运行 与 netstat.exe -ano ^> files\nstat.txt
相同(从命令行尝试)。
下一个命令有效(不幸的是,我目前无法在远程计算机上使用 /node:"server1"
进行尝试):
wmic process call create "cmd /C > C:\temp\test.txt 2>&1 netstat.exe -ano"