# Set priority of the DFSR process
# This process should already run
#
# Normal 32
# Low 64
# Real-time 128
# High 256
# Below Normal 16384
# Above Normal 32768
#
param(
$priority = 16384 ,
$CPUMask = 0xf
)
function Main
{
trap [Exception] {
write-host
$error[0] | Format-List -Force
exit 1; }
Get-WmiObject Win32_process -filter 'name = "dfsrs.exe"' | foreach-object { $_.SetPriority($priority) }
write-host "Priority of the process has been set ||| "
# Set Affinity
#
# 0xf = 1111 – a mask allowing use of only the first four processors
#
$dfsrSet = Get-Process -ProcessName "dfsrs"
foreach ($calc in $dfsrSet) {$calc.ProcessorAffinity=$CPUMask}
write-host "Affinity for the process has been set"
}
. Main
$error.Clear()
exit 0