$out = Get-WmiObject -class Win32_PerfFormattedData_Tcpip_NetworkInterface |
select name , BytesTotalPersec
$out.popup("Network status",0,"Done",0x1)
错误:方法调用失败,因为 [Selected.System.Management.ManagementObject]不包含 方法名为“弹出”。在第2行:char:1 + $ out.popup(“网络状态”,0,“完成”,0x1) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo:InvalidOperation:(popup:String)[],RuntimeException + FullyQualifiedErrorId:MethodNotFound
答案 0 :(得分:4)
students = ['Jacob', 'Joseph', 'Tony']
for student in students:
print(student)
students = ['Jacob', 'Joseph', 'Tony']
for student in students:
print(magician.title() + ", you got an amazing score on you exam!"
答案 1 :(得分:2)
PopUp是从Wscript.Shell类调用的方法。它不适用于WMI实例对象(或实例集合)。如果要使用示例中的弹出样式消息框显示该WMI查询的结果,则必须执行类似的操作。
$out = Get-WmiObject -class Win32_PerfFormattedData_Tcpip_NetworkInterface | select name , BytesTotalPersec | Out-String
$wshell = New-Object -ComObject Wscript.Shell
$wshell.Popup("Network Status:`n $out",0,"Done",0x1)
或者您可以通过将数据通过管道传输到gridview来简化它。
Get-WmiObject -class Win32_PerfFormattedData_Tcpip_NetworkInterface | select name , BytesTotalPersec | Out-GridView
希望有帮助。