Selasa, 10 Mei 2016

PowerShell v3 Test Memory Architecture

Three simple functions I saw the basis of a few ways back. Nothing special. Just good for reference. To test if a system is x86, run this:
function Isx86
{
      switch([IntPtr]::Size)
      {
            4
            {
                  $true
            }
            8
            {
                  $false
            }
      }
}
To test if a system is x64, use this approach:
function Isx64
{
      switch([IntPtr]::Size)
      {
            4
            {
                  $false
            }
            8
            {
                  $true
            }
      }
}
Another way to approach it:
function Get-ProcessorBitWidth
{
      switch([IntPtr]::Size)
      {
            2
            {
                  return 16
            }
            4
            {
                  return 32
            }
            8
            {
                  return 64
            }
      }
}
Much more complex tricks can be done, but, these are good to know about.

lamsim

About lamsim

Author Description here.. Nulla sagittis convallis. Curabitur consequat. Quisque metus enim, venenatis fermentum, mollis in, porta et, nibh. Duis vulputate elit in elit. Mauris dictum libero id justo.

Subscribe to this Blog via Email :