我正在尝试按照此处的帖子解析 w32tm 的输出并将项目排列在易于阅读的数据表中。我注意到我在不同的列中得到了无序、错误放置的结果。
在测试中,如果我输入:
w32tm /monitor /domain:mydomain.com.au /Threads:5
我得到正确排序和格式化的每台服务器,它的 NTP 偏移量和 ICMP 延迟显示完美,如下所示:
kesvm001.mydomain.com.au[xxx.xxx.xxx.x:xxx]:
ICMP: 37ms delay
NTP: -0.0446479s offset from VM021.mydomain.com.au
RefID: VM021.mydomain.com.au [xxx.xxx.xx.xxx]
Stratum: 4
VM033.mydomain.com.au[xxx.xxx.xxx.xx:xxx]:
ICMP: 50ms delay
NTP: -0.0640493s offset from VM021.mydomain.com.au
RefID: 80.84.77.86.rev.sfr.net [xx.xx.xx.xx]
Stratum: 2
如果我这样做:
$output = & w32tm /monitor /domain:mydomain.com.au /Threads:5
$output
我可以解释它的唯一方法是它似乎也输出所有详细信息......
Getting AD DC list for mydomain.com.au
Analyzing:Analyzing:Analyzing:Analyzing:Analyzing:Analyzing:Analyzing:Analyzing:Analyzing:Analyzing:Analyzing:Analyzing:Analyzing:Analyzing:Analyzing:Analyzing:Analyzing:Analyzing:delayoffset from VM021.mydomain.com.au
Stratum: 4
1 2 -- (0 of 48)
11 12 3 (9 of 48)
16 13 17 (14 of 48)
21 18 20 (18 of 48)
26 18 27 (24 of 48)
26 18 28 (25 of 48)
26 18 30 (27 of 48)
26 18 31 (28 of 48)
26 18 32 (29 of 48)
26 18 32 (29 of 48)
33 34 32 (31 of 48)
39 40 41 (38 of 48)
42 46 41 (43 of 48)
42 -- 41 (46 of 48)
-- -- 41 (47 of 48)
-- -- 41 (47 of 48)
-- -- 41 (47 of 48)
-- -- 41 (47 of 48)
kesvm001.mydomain.com.au[xxx.xxx.xxx.xxx:xxx]:
ICMP: 37ms
NTP: -0.1127470s RefID: VM021.mydomain.com.au [192.168.48.150]
VM033.mydomain.com.au[xxx.xxx.xxdelayoffset from VM021.mydomain.com.au
Stratum: 2
delayoffset from VM021.mydomain.com.au
Stratum: 4
delayoffset from VM021.mydomain.com.au
Stratum: 3
delayoffset from VM021.mydomain.com.au
Stratum: 4
delayoffset from VM021.mydomain.com.au
Stratum: 4
delayoffset from VM021.mydomain.com.au
Stratum: 4
delayoffset from VM021.mydomain.com.au
Stratum: 4
delayoffset from VM021.mydomain.com.au
我认为这可能与使用多个线程有关,但即使将 Threads 更改为 1 也没有什么区别。这里到底发生了什么?我所做的一切(我想)就是获取通常出现在屏幕上的任何输出,并将其放在一个变量中......