5

I just got my first 64-bit Windows notebook. Now I'm looking for information when and why to use the 32 or the 64-bit versions of PowerShell or ISE.

My first impression is that I better stay with 32 bit, until I understand things better.

What I miss or didn't find are basic tutorials and practical experiences and links to this questions.

JPBlanc
  • 70,406
  • 17
  • 130
  • 175
bernd_k
  • 11,558
  • 7
  • 45
  • 64

5 Answers5

5

I'am working on a Seven 64Bits and W2K8 R2 for one year now, and, on the command line, I'am always using 64 bits Powershell without any troubles.

For me the problem is not to choose 32 or 64 Bit PowerShell.exe, but to know that the two exists, and that a 32 bits process will use the 32 bits PowerShell. For example if you use PowerShell as post build execution script in Visual Studio 2010, it will use 32 bits PoweShell because Visual Studio 2010 is 32 bits process.

The two versions see two differents places in the registry so you have to Set-ExecutionPolicy for both.

As scripting is concerned I do not use ISE, but PowerGUI script Editor. You can use

[intPtr]::size

in a script to know if you are runing 32 or 64 bits PowerShell.exe.

JPBlanc
  • 70,406
  • 17
  • 130
  • 175
  • 2
    [intPtr]::size returns 4 for 32 bit PowerShell, and 8 for 64 bit PowerShell (at least on my machine). [The docs](https://msdn.microsoft.com/en-us/library/system.intptr.size(v=vs.110).aspx) say the value is in Bytes, so this makes sense, but just wanted to point it out. – NH. Feb 27 '18 at 19:56
3

You would use the 64 bit versions of PowerShell or PowerShell ISE where the problem you are trying to solve is uniquely 64 bit. For example:

  1. You need your PowerShell script to be able to consume more memory than a 32 bit application will allow

  2. You are consuming libraries that are 64 bit only or need to run in a 64 bit environment. For example on Windows 2008R2/IIS7.5 if you are using the Microsoft.Web.Management managed wrapper, if you need to modify administration.config via this library then your application or script needs to run in a 64 bit process.

Community
  • 1
  • 1
Kev
  • 118,037
  • 53
  • 300
  • 385
  • At work (x64) I'll try to run a script that simply requests memory until it crashes and watch memory consumption. I believe that the limits are much lower than 4gb; imho OutOfMemoryExc will come sooner. – stej Aug 21 '11 at 11:41
  • Ok, bad assumption from old ASP.NET experiences :) The memory ended up with 10GB. So forget my note (leaving it here undeleted). – stej Aug 22 '11 at 12:50
2

I typically stick with 64-bit PowerShell unless I have a good reason to not use it. One issue with 32-bit PowerShell is that you may accidentally find yourself in HKLM:\SOFTWARE\Wow6432Node location of the registry instead of where you think you are.

The example I've most-often come across for an explicit need for 32-bit is when using certain COM objects. For example, if you have a 64-bit OS, but 32-bit Office... If you want to instantiate a Word, Excel, or Access object, you're going to need to be in 32-bit PowerShell or else it's going to act as if you don't have Office installed at all.

Daniel Richnak
  • 1,584
  • 8
  • 12
0

When running SharePoint 2013, it's important to run the 64-bit versions when attempting to user the Windows.SharePoint.PowerShell snapin. I spent too much time not realizing I had open the 32-bit ISE not being able to load SharePoint Commands.

Marek Musielak
  • 26,832
  • 8
  • 72
  • 80
-1

I think you don't really need to take care about that. As for my 64bit system, there is only a 32bit PowerShell preinstalled (in \system32) and it works without any issues. So just use it ;) And well, besides that, it's most likely the same case as with any other application: if you rely on functions/properties that are only available under 64bit you are better of to use the 64bit version of that application.

Brian
  • 2,130
  • 22
  • 29
  • 7
    On a 64 bit system I think you'll find that the PowerShell that resides in `system32\WindowsPowerShell` is the 64 bit version. As with all 64 bit Windows OS's, the 32 bit files, tools, DLL's etc reside in `C:\Windows\SysWOW64` and the 32 bit edition of PowerShell resides in `C:\Windows\SysWOW64\WindowsPowerShell`. – Kev Aug 21 '11 at 11:34