在远程计算机上执行应用程序
问题描述:
我想在远程计算机上启动进程(我知道远程计算机的管理凭证)。用于远程机器上开始一个应用程序,我使用“调用命令”或“输入的PSSession”,这将启动远程机器上处理在远程计算机上执行应用程序
Start-Process -FilePath 'C:\pqr.exe' -ArgumentList '/a' -Verb runas -WindowStyle Normal
命令。现在问题是,我能够开始处理,但很快处理CPU分配的饥饿(它变为0%),并且突然启动的应用程序不再重新编码。有没有其他的方式来分配它的CPU或运行管理员权限以上的commandlet。
答
你应该开始处理,然后改变进程的优先级 的命令行语法:
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]
指定 “正常,空闲,高,实时,BelowNormal,AboveNormal” 例如
$a = (Get-Process -Name powershell)
$a.PriorityClass = [System.Diagnostics.ProcessPriorityClass]::RealTime
无法在对象 – 2015-04-01 04:24:03
@ kaustubh93上找到属性“Priorityclass”proirtyclass正在使用.net 4.5的powersehll v4工作,导致get-process'请参见[link](https:// t echnet.microsoft.com/en-us/library/hh849832.aspx)...但wmi查询应该为你工作 – powershell 2015-04-01 15:41:59