$out = Get-WmiObject -class Win32_PerfFormattedData_Tcpip_NetworkInterface |
select name , BytesTotalPersec
$out.popup("Network status",0,"Done",0x1)错误:方法调用失败,因为Selected.System.Management.ManagementObject不包含名为“弹出”的方法。行:2个字符:1+$out.popup(“网络状态”,0,“完成”,0x1)+~+ CategoryInfo : InvalidOperation:(弹出:字符串) [],RuntimeException RuntimeException+ FullyQualifiedErrorId : MethodNotFound
发布于 2019-06-23 01:14:14
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)或者,您可以通过将数据传递到一个网格视图来简化它。
Get-WmiObject -class Win32_PerfFormattedData_Tcpip_NetworkInterface | select name , BytesTotalPersec | Out-GridView希望这能有所帮助。
发布于 2019-06-22 18:13:04
using assembly System.Windows.Forms
using namespace System.Windows.Forms
[messagebox]::show('hello world')https://stackoverflow.com/questions/56717878
复制相似问题