Determining 32/64 bit in Powershell

前端 未结 6 1955
梦谈多话
梦谈多话 2021-01-02 04:14

I am trying to create a couple lines of code that will pull from WMI if a machine is either 32/64 bit and then if it is 64 do this .... if it is 32bit do this...

Can

6条回答
  •  渐次进展
    2021-01-02 05:11

    There's two boolean static methods in the Environment you can inspect and compare, one looks at the PowerShell process, one looks at the underlying OS.

    if ([Environment]::Is64BitProcess -ne [Environment]::Is64BitOperatingSystem)
    {
    "PowerShell process does not match the OS"
    }
    

提交回复
热议问题