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://bbs.bathome.net/)
Powered by Discuz! 7.2