【问题标题】:How can I stop a program on another computer using CMD with Powershell如何使用 CMD 和 Powershell 在另一台计算机上停止程序
【发布时间】:2021-08-03 02:45:57
【问题描述】:

我想在卸载 Pulse Secure 并使用 Powershell 安装更新版本之前停止它

在计算机的 CMD 中,您可以键入以下内容来停止它:

"C:\Program Files (x86)\Common Files\Pulse Secure\JamUI\Pulse.exe" -stop

但我似乎无法从 Powershell 中阻止它。我尝试了几种不同的变体,但似乎无法获得它。

$PC = (Read-Host "Enter Computer Name").ToUpper()
ICM $PC {& cmd.exe /c '"C:\Program Files (x86)\Common Files\Pulse Secure\JamUI\Pulse.exe" -stop'}

.

$PC = (Read-Host "Enter Computer Name").ToUpper()
$STOP = "C:\Program Files (x86)\Common Files\Pulse Secure\JamUI\Pulse.exe"
ICM $PC {& cmd.exe /c "$STOP -stop"}

第二个选项返回 '-stop' 不被识别为内部或外部命令...有什么建议或更好的方法来阻止它吗?

【问题讨论】:

    标签: powershell pulsesecure


    【解决方案1】:
    invoke-command -ComputerName $pc -ScriptBlock {Stop-process -name Pulse -force}
    

    做到了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-11-10
      • 1970-01-01
      • 2022-10-12
      • 2014-01-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多