Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [int]$vcpus = (Get-CimInstance -classname win32_processor|measure-object -Property NumberOfLogicalProcessors -Sum).Sum
- [int]$affinityMask = [math]::Pow( 2 , $vcpus ) - 1
- ## https://docs.microsoft.com/en-gb/dotnet/api/system.diagnostics.process.processoraffinity?view=netframework-1.1#System_Diagnostics_Process_ProcessorAffinity
- Get-Process | where-object { $_.ProcessorAffinity -and $_.ProcessorAffinity.ToInt32() -ne $affinityMask } | select-object name,id,sessionid,starttime,ProcessorAffinity,@{n='BinaryAffinity';e={ [convert]::ToString( [string]$_.ProcessorAffinity , 2 )}},@{n='Processors';e={[int]$n=$_.ProcessorAffinity;[int]$bits=0;while($n) { $bits += ($n -band 1) ;$n = $n -shr 1 };$bits }}|Format-Table -AutoSize
Add Comment
Please, Sign In to add comment