远程Powershell弹出消息

远程Powershell弹出消息,powershell,vbscript,scripting,wsh,Powershell,Vbscript,Scripting,Wsh,我正在尝试为登录到目标计算机的任何用户创建远程powershell弹出窗口 我发现了一个创建弹出窗口的简单脚本: (New-Object -ComObject wscript.shell).popup("THIS IS A TEST MESSAGE") 但是,我无法在远程设备上运行此脚本。我们的环境中限制了powershell远程处理,因此我无法在powershell中使用invoke命令cmdlet 过去,我使用Invoke-WmiMethod cmdlet并远程创建新流程以实现所需结果,从

我正在尝试为登录到目标计算机的任何用户创建远程powershell弹出窗口

我发现了一个创建弹出窗口的简单脚本:

(New-Object -ComObject wscript.shell).popup("THIS IS A TEST MESSAGE")
但是,我无法在远程设备上运行此脚本。我们的环境中限制了powershell远程处理,因此我无法在powershell中使用invoke命令cmdlet

过去,我使用Invoke-WmiMethod cmdlet并远程创建新流程以实现所需结果,从而绕过了此限制,如:

Invoke-WmiMethod -Class Win32_Process -ComputerName $computer -Name Create -ArgumentList "C:\Program Files\Test\Test.exe -argument"
然而,我似乎找不到一种方法来生成一个远程弹出窗口使用这种方法


有人对我如何实现目标有什么好主意吗

我知道了。我使用msg.exe应用程序显示我的消息,并使用powershell Invoke WmiMethod在PC上本地执行命令,因为我们禁用了远程消息:

Invoke-WmiMethod -Class Win32_Process -ComputerName HostPC -Name Create -ArgumentList "C:\Windows\System32\msg.exe * This is a test message."

我明白了。我使用msg.exe应用程序显示我的消息,并使用powershell Invoke WmiMethod在PC上本地执行命令,因为我们禁用了远程消息:

Invoke-WmiMethod -Class Win32_Process -ComputerName HostPC -Name Create -ArgumentList "C:\Windows\System32\msg.exe * This is a test message."

我使用Powershell编辑了上面的脚本示例,使其更易于使用变量运行,因此您不必每次都编辑该文件

$server = read-host -prompt 'Input server name';
$message = read-host -prompt 'add text string'; 
Invoke-WmiMethod -Class win32_process -ComputerName $server -Name create -ArgumentList  "c:\windows\system32\msg.exe * $message" 

感谢您提供了原始答案

我使用Powershell编辑了上面的脚本示例,使其更易于使用变量运行,因此您不必每次都编辑该文件

$server = read-host -prompt 'Input server name';
$message = read-host -prompt 'add text string'; 
Invoke-WmiMethod -Class win32_process -ComputerName $server -Name create -ArgumentList  "c:\windows\system32\msg.exe * $message" 
谢谢你的原始答案