开发者

Why and when to use 32 or 64-bit PowerShell or ISE?

开发者 https://www.devze.com 2023-03-29 09:04 出处:网络
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.

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 开发者_StackOverflowor didn't find are basic tutorials and practical experiences and links to this questions.


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.


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.


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.


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号