【问题标题】:Execute application on remote computer在远程计算机上执行应用程序
【发布时间】:2015-06-04 01:04:56
【问题描述】:

我想在远程计算机上启动一个进程(我知道远程计算机的管理凭据)。在我使用的远程机器上启动应用程序

    Start-Process -FilePath 'C:\pqr.exe' -ArgumentList '/a' -Verb runas -WindowStyle Normal

带有“Invoke-command”或“Enter PsSession”的命令将在远程机器上启动进程。现在的问题是,我能够启动进程,但很快进程就无法分配 CPU(它变为 0%),并且突然启动的应用程序变得无法响应。有没有其他方法可以分配 CPU 或在具有管理员权限的命令行开关上运行。

【问题讨论】:

    标签: windows powershell wmi powershell-2.0 powershell-3.0


    【解决方案1】:

    您应该启动进程然后更改进程的优先级 命令行语法:

    wmic process where name="AppName" CALL setpriority ProcessIDLevel
    

    例子:

    wmic process where name="notepad.exe" CALL setpriority 32768
    

    wmic process where name="notepad.exe" CALL setpriority "above normal"
    

    优先级:

    空闲:64

    低于正常值:16384

    正常:32

    高于正常值:32768

    高优先级:128

    实时:256

    或使用 powershell [System.Diagnostics.ProcessPriorityClass] 指定以下枚举值之一“Normal、Idle、High、RealTime、BelowNormal、AboveNormal” 例子

    $a = (Get-Process -Name powershell)
    $a.PriorityClass = [System.Diagnostics.ProcessPriorityClass]::RealTime
    

    【讨论】:

    • 在对象上找不到属性“Priorityclass”
    • @kaustubh93 proirtyclass 仅适用于具有 .net 4.5 的 powersehll v4,因为 get-process 参见 link... 但 wmi 查询应该适合您
    【解决方案2】:

    你试过了吗:

    PsExec

    也许这对你有用

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-09-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-21
      • 2011-11-23
      相关资源
      最近更新 更多