What Version of PowerShell am I Using?
OK, this seems like a basic question, but even without SharePoint or the PowerShell IDE (Integrated Development Environment) loaded, there are two distinct versions of PowerShell on any given system. Both versions are listed under All Programs à Accessories à Windows PowerShell, and as you might imagine, there are 32-bit (x86) and 64-bit (x64) variants:
- Windows PowerShell (x86)
- Windows PowerShell
The reason I bolded that last one is because this is most likely the only one we will use when it comes to SharePoint administration.
But hey, hold on a moment before you start PowerShell. Most often, you will be interacting with the system (assuming you are on a server) in an administrative role. This role is necessary to execute some PowerShell scripts you will encounter.
From All Programs à Accessories à Windows PowerShell, Right-Click Windows PowerShell and select Run as administrator.
If you have UAC (User Account Control) enabled, you will receive a prompt, indicating that you are intending to start PowerShell as an Administrator. Select “Yes” to continue.
PowerShell should now start in the proper user context: Administrator; this is verified by the Title line of the PowerShell window:
Interestingly enough, the image above also indicates that the 64-bit (x64) version of PowerShell is currently running; it does so simply by not showing the (x86) by PowerShell in the title. Below is what the same screen would look like in (x86) mode.
So now, the only question is, what version of PowerShell am I running, 1.0 or 2.0? The way to tell this is simply ask PowerShell itself by typing $host and pressing <Enter>.
If you have PowerShell 1.0 installed (maybe you are running on Windows Server 2008 instead of Windows Server 2008 R2), uninstall it and go get PowerShell 2.0 (as part of the Windows Management Framework) from Microsoft at http://support.microsoft.com/kb/968929.
By the way, if you are installing the prerequisite files for SharePoint 2010, it will download PowerShell 2.0 as part of these files, but you will miss your chance to make changes before SharePoint is ever installed onto your system.