帮助我弄清楚当 WMI 无法连接到主机并转到列表中的下一台计算机时脚本将如何继续运行。我应该在 except 之后使用 continue 吗?
import wmi
MachineList = ["Computer1","Computer2","Computer3"]
try:
for machines in MachineList:
c = wmi.WMI(machines) # <---- Go to next in the for loop when connection fail???
for os in c.Win32_OperatingSystem():
print os.Caption
except:
pass