function Change-ProcessPriority{<#.EXAMPLE 1Change-ProcessPriority "High".NOTESAuthor: Will Steele (wlsteele@gmail.com)Last Modified Date: 06/14/2012.PARAMETER PriorityA mandatory string indicating the process level to which you want toupdate a processes priority level.#>param([Parameter(Mandatory = $true)][ValidateSet("AboveNormal","BelowNormal","High","Idle","Low","Normal","RealTime")]$Priority)if((Get-Process -Id $PID).PriorityClass -eq $Priority){Write-Output "The process priority for PID ($PID) is already set to $($Priority).";}else{Write-Output "Setting the process priority for PID ($PID) to $($Priority).";(Get-Process -Id $PID).PriorityClass = $Priority;}}
Tuesday, June 28, 2016
PowerShell v3 Function Change ProcessPriority
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment