- 帖子
- 2874
- 积分
- 7021
- 技术
- 336
- 捐助
- 0
- 注册时间
- 2011-6-2
|
[转载代码] [PowerShell每日技巧]降低PowerShell进程的优先级(20140102)
When you run a PowerShell task, by default it has normal priority, and if the things your script does are CPU intensive, the overall performance of your machine may be affected.
To prevent this, you can assign your PowerShell process a lower priority and have it run only when CPU load allows. This will ensure that your PowerShell task won't degrade performance of other tasks.
This sample sets the priority to "below normal". You can also set it to "Idle" in which case your PowerShell script would only run when the machine has nothing else to do:
$process = Get-Process -Id $pid
$process.PriorityClass = 'BelowNormal'
http://powershell.com/cs/blogs/tips/archive/2014/01/02/lowering-powershell-process-priority.aspx |
|