How to install Windows PowerShell 4.0

Windows PowerShell 4.0 is part of the Windows Management Framework 4.0, which includes the following:

  • Windows PowerShell
  • Windows PowerShell Integrated Scripting Environment (ISE)
  • Windows PowerShell Web Services (Management OData IIS Extension)
  • Windows Remote Management (WinRM)
  • Windows Management Infrastructure (WMI)
  • Server Manager WMI provider
  • Windows PowerShell Desired State Configuration (DSC)


Windows Management Framework 4.0 supportability matrix

Operating system

Windows PowerShell 4.0 available


Installation file

Windows Server 2012 R2




Windows 8.1




Windows Server 2012

Yes, part of WMF 4.0

.NET 4.5 (built-in)

x64: Windows8-RT-KB2799888-x64.msu

Windows 8

No, user must upgrade to Windows 8.1



Windows Server 2008 R2

Yes, part of WMF 4.0

Windows Server 2008 R2 SP1

.NET 4.5

x64: Windows6.1-KB2819745-x64-MultiPkg.msu

Windows 7

Yes, part of WMF 4.0

Windows 7 SP1

.NET 4.5

x64: Windows6.1-KB2819745-x64-MultiPkg.msu

x86: Windows6.1-KB2819745-x86.msu



  • Verify that all prerequisites is installed according to the Windows Management Framework 4.0 supportability matrix above. To verify the presence of .NET 4.5, you may use the Test-Net45 function available in this article on the Hey Scripting Guy! Blog
  • Run the installation file applicable to the operating system
  • Reboot the computer, start Windows PowerShell and verify that the output of $PSVersionTable shows 4.0 as the value of the PSVersion property


Known issues


1 – Installation succeeds even if .NET 4.5 is not installed

Scenario: Installing WMF 4.0 on a computer that is not running .NET Framework 4.5 will report that the installation is successful, but the components of WMF 4.0 (such as Windows PowerShell, WMI, etc.) will not be updated.

Solution: Install .NET Framework 4.5, and then run the WMF 4.0 installer again.

More information:


2 – Compatibility issues

There are known compatibility issues with several Microsoft server-class applications:

· System Center 2012 Configuration Manager (not including SP1)

· System Center Virtual Machine Manager 2008 R2 (including SP1)

· Microsoft Exchange Server 2013, Microsoft Exchange Server 2010, and Microsoft Exchange Server 2007

· Microsoft SharePoint Server 2013 and Microsoft SharePoint Server 2010

· Windows Small Business Server 2011 Standard

Read the WMF 4.0 Release Notes for more information.


Related KB articles


This article is also posted on the Microsoft TechNet Wiki. If you have corrections or additional information, please update the Wiki-article.

Get-PrinterDriver driver version

Windows Server 2012 introduced the Print Management Cmdlets in Windows PowerShell, which is also available on Windows 8 if you install the Remote Server Administration Tools.

What I want to show in this article is a challenge when working with the Get-PrinterDriver cmdlet, related to version info.

Let us have a look at the default output:


With an IT Professionals mindset, the MajorVersion property shown in the default output would probably be the printer drivers driver version, right?

Let us have a look at the same printer drivers using the Print Management MMC Console:


If we compare the two outputs, an educated guess would tell us that the MajorVersion property in the output of Get-PrinterDriver is actually the driver type (for example “Type 3 – User Mode”).

So how can we get the “Driver Version” property in the Print Management MMC Console in PowerShell? Let us use Get-Member to explore what properties is available on an object produced by Get-PrinterDriver:


It seems like the property “DriverVersion” is what we want, let us try:


This does not look very promising. The data we want is there, but not in a human readable format. The data is in an uint64 format, and would need to be converted in order to see the same values as we get in the Print Management MMC Console.

We can find an explanation on how the data is represented in this article on MSDN:


By using Select-Object we can convert the DriverProperty value into the same format as the Print Management MMC Console:


Thanks to PowerShell MVP Keith Hill for assisting with the conversion process.

I have also filed a suggestion on Microsoft Connect suggesting that more user friendly driver version information should be available by default on the objects created by the Get-PrinterDriver cmdlet.

If you find the need to provide feedback to Microsoft, whether it is bug reports or feature suggestions, you can find more information on how to do this in a previous article I have written.

Converting Hyper-V VHD-files to VHDX using Windows PowerShell

With the introduction of Windows Server 2012 Hyper-V, Microsoft also provided a new format for virtual hard disk files. The previous VHD-format is now updated to a new format called VHDX. Some of the new features of the new format is much larger storage capacity (from a maximum of 2 TB for VHD, to a new maximum of 64 TB for VHDX), as well as data corruption protection during power failures. You can find more information about the new VHDX format on the “Hyper-V Virtual Hard Disk Format Overview” article on Microsoft TechNet, as well as the “VHDX Format Specification v 1.0” document which provides detailed information.

When virtual machines are migrated (imported) to a Windows Server 2012 Hyper-V host, the virtual hard disk files is not automatically converted to the new VHDX format. This is something you must do manually, either by using the “Edit Virtual Hard Disk Wizard” or by using the Convert-VHD cmdlet in the Hyper-V PowerShell module.

As soon as a virtual machine is migrated from an earlier version of Hyper-V to Windows Server 2012 Hyper-V, best practice would be to convert the virtual hard disk files to the new VHDX format.

If you have more than a couple of virtual machines, it would be a good idea to automate the conversion process. You can start to explore the Convert-VHD cmdlet by running Get-Help “Convert-VHD” –ShowWindow:


If you do not get a similar result as above, run Update-Help from an elevated PowerShell session and try again.

If you scroll to the bottom you will also find a few examples:


Example 1 shows how to convert a single VHD file to a new VHDX file. There are several things to consider before doing this in a production environment:

  • Should you keep the source VHD in case something goes wrong? If no, add the –DeleteSource swich parameter.
  • Should you use Fixed disks or Dynamically expanding disks? There are different recommendations both in the community and in Microsoft. In the Performance Tuning Guidelines for Windows Server 2012 dynamically expanding is recommended, while in this Premier Field Engineering (PFE) blog article Fixed size is recommended. To read more opinions from the community, see this article by Virtual Machine MVP Aidan Finn as well as this article by Virtual Machine MVP Thomas Maurer.
  • The virtual machine must be stop before its virtual hard disk files can be expanded.
  • The old VHD file must be replaced by the new VHDX file in the virtual machine configuration.
  • Enough disk space must be available on the underlying data disk. For example, if the VHD file to be converted is 100 GB, you must have minimum 100 GB free space on the data disk for the destination VHDX file.

I have created a sample PowerShell script below which will convert VHD-files for stopped virtual machines to VHDX. If the virtual hard disk files for the stopped virtual machines is already of type VHDX, the virtual machine will be skipped.

You may want to add additional logging and error handling before using this script in a production environment. I would also encourage to always test the script in a lab environment before using it in production.

You can find the script here on the Microsoft TechNet Script Center.