Powershell – Method invocation failed while trying to create a pop up

azure-powershellpowershellpowershell-2.0powershell-3.0powershell-core

$out = Get-WmiObject -class Win32_PerfFormattedData_Tcpip_NetworkInterface |
    select name , BytesTotalPersec

$out.popup("Network status",0,"Done",0x1)

Error : Method invocation failed because
[Selected.System.Management.ManagementObject] does not contain a
method named 'popup'. At line:2 char:1
+ $out.popup("Network status",0,"Done",0x1)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (popup:String) [], RuntimeException
    + FullyQualifiedErrorId : MethodNotFound

Best Answer

using assembly System.Windows.Forms
using namespace System.Windows.Forms
[messagebox]::show('hello world')
Related Topic