Windows PowerShell 4.0

Windows PowerShell 4.0Windows PowerShell 4.0

Version 4 seem like a routine upgrade of a mature product.  In truth, PowerShell V4.0 lacks the excitement or killer new feature of V3 (Intellisense) or V2 (Remoting).

PowerShell 4.0 New Features

 ♦

What's New In PowerShell 4.0

This is what you get on Windows 8.1 and Server 2012 R2; please note that older operating systems do not support many of these features.

  • DSC Desired State Configuration
  • Save-HelpGet-FileHash
  • Get-NetNat
    http://technet.microsoft.com/en-us/library/dn283352.aspx
  • Get-VMFirmware
  • Set-ScheduledJob - Run job immediately.  -RunNow parameter
  • New-JobTrigger and Set-JobTrigger cmdlets is RepeatIndefinitely
  • Test-NetConnection
  • Test-VMNetworkAdapter

Installing PowerShell 4.0

Remember that you get PowerShell version 4.0 automatically with Windows 8.1 and Server 2012 R2.  No installation is required here.

Note the version number of your operating system; with Windows 8.0 you only get PowerShell 3.0.  Unbelievably, In order to get version 4 here you have to upgrade the operating system to 8.1.

If you have plain Server 2012, 2008 R2, or Windows 7, then you can install Windows Management Framework 4.0, and thus get PowerShell 4.0.

Installing PowerShell 4.0 on Windows 7 SP1

What I did was download the Windows Management Framework (WMF) 4.0 from Microsoft's Download Center.  The install file was called: Windows6.1-KB2819745-x64-MultiPkg.msu.

The .Net Framework installation, coupled with PowerShell 4.0 upgrade, was beautifully predictable and blissfully uneventful.

Problems with PowerShell 4.0 on Windows 7
Actually, the problem started in PowerShell 3.0, simply, you don't get all the modules and thus a complete set of cmdlets.  Sadly, this ommision is by design, the Windows 7 architecture simply does not support some features supplied in Windows 8.1.

Windows Management Framework 4.0

Here is a list of what the Windows 6.1-KB2819745.msu contains:
Updates for:

  • Windows PowerShell 4.0
  • Windows PowerShell ISE
  • Windows Remote Management (WinRM)
  • Windows Management Instrumentation (WMI)
  • Windows PowerShell Web Services (Management OData IIS Extension)
  • The Server Manager WMI provider

New feature DSC:
PowerShell's Desired State Configuration (DSC) is rather like a function, but instead of scripting a 'Process', you specify Nodes and Resource blocks.  See more on PowerShell's DSC.

Guy Recommends:  A Free Trial of the Network Performance Monitor (NPM)Review of Orion NPM v11.5 v11.5

SolarWinds' Network Performance Monitor will help you discover what's happening on your network.  This utility will also guide you through troubleshooting; the dashboard will indicate whether the root cause is a broken link, faulty equipment or resource overload.

What I like best is the way NPM suggests solutions to network problems.  Its also has the ability to monitor the health of individual VMware virtual machines.  If you are interested in troubleshooting, and creating network maps, then I recommend that you try NPM now.

Download a free trial of Solarwinds' Network Performance Monitor

Traps for Installing WMF 4.0

  1. Windows 8.  No go, it doesn't work.  Solution: upgrade to Windows 8.1
  2. Uninstall any pre-release (beta) versions of Windows Management Framework 4.0
  3. The old chestnut: choose the correct architecture x64 or x86.
  4. Don't install WMF 4.0 on any of these servers:
    System Center 2012 Configuration Manager (not including SP1)
    System Center Virtual Machine Manager 2008 R2 (including SP1)
    Microsoft Exchange Server 2013, 2010, or 2007
    Microsoft SharePoint 2013 or 2010
    Windows Small Business Server 2011 Standard

Uninstalling PowerShell 4.0

If you need to uninstall WMF, then head for the Control Panel\Programs, 'Uninstall a program', and find: KB2819745.

Check Your Version of PowerShell with $Host

Here is simple command to check your version of Windows PowerShell.

# Windows PowerShell Version Check
Clear-Host
$Host

Name: 			Windows PowerShell ISE Host
Version: 4.0 InstanceId: d36fdafd-f9e9-4642-bc85-6dea29105f61
UI: System.Management.Automation. Internal.Host.InternalHostUserInterface
CurrentCulture: en-GB
CurrentUICulture: en-US
PrivateData: Microsoft.PowerShell.Host.ISE.ISEOptions
IsRunspacePushed: False Runspace: System.Management.Automation. Runspaces.LocalRunspace

Advanced Check .Net Version

Here is a script which interrogates the NET Framework section of the registry.

Clear-Host
Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' -Recurse |
Get-ItemProperty -Name Version -EA 0 |
Where { $_.PSChildName -Match '^(?!S)\p{L}'} |
Format-Table PSChildName, Version -AutoSize

PSChildName                      Version       
-----------                      -------       
v2.0.50727                       2.0.50727.5420
v3.0                             3.0.30729.5420
Windows Communication Foundation 3.0.4506.5420 
Windows Presentation Foundation  3.0.6920.5011 
v3.5                             3.5.30729.5420
Client                           4.5.50938     
Full                             4.5.50938     
Client                           4.0.0.0     

Note: This information was obtained from a Windows 7 machine.

What's new in PowerShell 4.0 »

Summary of PowerShell 4.0

While Windows 8 was the catalyst for the release of PowerShell version 3.0,   Windows Server 2012 R2 may have been the reason for releasing PowerShell 4.0 in general, and the Desired State Configuration (DSC) in particular.

This is the situation: you get PowerShell version 4.0 automatically with Windows 8.1 and Server 2012 R2.  If you have plain Server 2012, 2008 R2, or Windows 7 then you can install Windows Management Framework 4.0 and thus get PowerShell v 4.0.

If you like this page then please share it with your friends

 


See more Windows PowerShell sections

PowerShell Home   • Introduction  • Dreams   • 3 Key Commands   • Free Permissions Analyzer

PowerShell Real-life Examples   • PowerShell Techniques   • PowerShell Syntax   • Contact

PowerShell ISE  • PowerShell 2.0   • PowerShell v 3.0   • PowerShell v 4.0   • PowerShell v 4.0

Please email me if you have a better example script. Also please report any factual mistakes, grammatical errors or broken links, I will be happy to correct the fault.

 

 *


Custom Search

Site Home

Guy Recommends: WMI Monitor for PowershellSolarwinds WMI Monitor

Windows Management Instrumentation (WMI) is most useful for PowerShell scripting.

SolarWinds have produced this Free WMI Monitor to take the guess work out of which WMI counters to use for applications like Microsoft Active Directory, SQL or Exchange Server.

Download your free copy of WMI Monitor

Author: Guy Thomas Copyright © 1999-2017 Computer Performance LTD All rights reserved.

Please report a broken link, or an error to: