在远程计算机上执行应用程序

时间:2015-03-30 20:47:45

标签: windows powershell wmi powershell-v2.0 powershell-v3.0

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

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

命令" Invoke-command"或"输入PsSession"这将在远程机器上启动进程。现在的问题是,我能够启动进程,但很快就会为CPU分配处理饥饿(它变为0%),突然之间,launced应用程序变得没有重新编码。有没有其他方法可以分配CPU或在管理员权限上运行上面的命令行开关。

2 个答案:

答案 0 :(得分:0)

你应该开始进程然后改变进程的优先级 命令行语法:

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

答案 1 :(得分:0)

你试过这个:

PsExec

也许这对你有用