Tag Archives: v3preview

PowerShell V3 CTP2 – Now Available

The second Community Technology Preview of PowerShell V3 is now available. This pre-beta release gives of a flavour of areas of change which may appear in the final release. A CTP has an emphasis on Community , i.e. the PowerShell team is looking for plenty of feedback for this release while they still have time to change things. Below are items logged on Connect by the community which have been fixed since the release of CTP1 – so if you find an issue in your testing, please log it onย Connect so it can be reviewed and potentially resolved.

689302 Unable to catch PSRemotingTransportException
690139 Get-Command gets duplicated result if a requested script path contains “..”.
676882 Out-GridView and properties with dots
687776 ISE Editor Enhancements
687886 2-pane “more console-like” mode for ISE
688630 PowerShell ISE v3 – UserEnterToSelectInCommandPaneIntellisense should be on by default
690164 V3 – out-gridview – remove a criteria close the grid window
690556 Tab Complete in Remote Session
690784 PS3CTP1 – Object casting regression
690864 Import-Module should check the required PowerShell version before anything else
690895 PS3CTP1: PowerShell.exe shows THROWN error Message in normal output color
691206 PoshV3CTP1: PowerShell Events do not trigger when used with UI (WPF & Windows Forms)
691439 Having an append ability in Export-CSV.
692617 StopProcessing doesn’t work in v3
692776 PS3CTP1: Variables as property names BROKEN with Assignment Operators
693754 Powershell 3.0 ISE editor corrupts text
694600 Run with Powershell not executing scripts
694940 NestedModules are unloaded from GLOBAL scope with the parent module.
694942 NestedModules doesn’t support specifying the version
695755 v3 CTP1: Breaking change – DayOfWeek and left-hand rule
695978 PS3CTP1: REGRESSION: Get-Member -Static Error
697131 v3 CTP1: Char[] not reversed by Array.Reverse static method
704136 Divide by Zero $? Test Returns True


PowerShell V3 CTP2 is part of the Windows Management Framework (WMF) 3.0 CTP2 and can be installed on the following Windows configurations.

Operating System SP Level SKUs Languages
Windows 7 SP1 All English
Windows Server 2008 R2 SP1 and greater All but IA64 English

Full details on other changes in CTP2 are detailed on the PowerShell Team Blog:


Iโ€™m pleased to announce that the Community Technology Preview #2 (CTP2) is available for download.

Windows Management Framework 3.0 CTP2 makes some updated management functionality available to be installed on Windows 7 SP1 & Windows Server 2008 R2 SP1. Windows Management Framework 3.0 contains Windows PowerShell 3.0, WMI & WinRM.

IMPORTANT: If you have WMF3.0 CTP1 installed, you must uninstall it before installing CTP2.

Overview of changes since WMF 3.0 CTP1
1. Customer Reported Bug Fixes
Many customer reported bugs have been fixed since the WMF 3.0 CTP1. The release notes contains a list of bug titles, but please check Connect for full details.

2. Single Command Pane in Windows PowerShell ISE
The Command and Output panes in Windows PowerShell ISE have been combined into a single Command pane that looks and behaves like the Windows PowerShell console.

3. Updatable Help
The WMF 3.0 CTP1 release notes described a new Updatable Help system in Windows PowerShell 3.0 and included a copy of the help content. The Updatable Help system is now active on the Internet. To download and update help files, type: Update-Help.

4. Windows PowerShell Workflows
A number of enhancements have been made in the scripting experience for Windows PowerShell Workflows, including new keywords: Parallel, Sequence & Inlinescript. A document describing these changes will be published to the download page shortly.

5. Remote Get-Module
The Get-Module cmdlet now supports implicit remoting. You can now use the new PSSession and CIMSession parameters of the Get-Module cmdlet to get the modules in any remote session or CIM session. A number of other module enhancements are listed in the release notes.

Feedback & Bugs
We welcome any feedback or bug submissions to the Windows PowerShell Connect site: http://connect.microsoft.com/PowerShell

Additional Information:
This software is a pre-release version. Features and behavior are likely to change before the final release.

This preview release is designed to enable the community to experience and review the preliminary designs and direction of key features Windows PowerShell 3.0 and to solicit feedback before features are finalized.

For an interesting post describing what to expect with a CTP, read this very old post from Jeffrey

Travis Jones [MSFT]
Program Manager โ€“ Windows PowerShell
Microsoft Corporation

PowerShell v3 – ISE Commands Add-on

*****Warning. This is from a preview release******

PowerShell ISE in v2 allowed you to create your own custom menu items via PowerShell script (a good example can be found on the Hey Scripting Guy blog)

PowerShell ISE in v3 ships with an Add-on built in called Commands. This Add-on places (by default) a Commands entry in the Add-on Tools Pane as below:

This Add-on is a very useful learning and reference tool since it provides access to help info for cmdlets and will help you add the necessary parameters you are looking for.

If you have many PowerShell modules in your system, you can filter the list by Module or by name:

Filtering by the Microsoft.PowerShell.Core Module:

Filtering by name, Get-H:

Once you have found the cmdlet you are looking for, many of them will contain parameter options:

You can access the help from the ? button, from which a searchable Help window will appear. You can scroll up or down to read all of it, or use the search to skip directly to a phrase:

In the parameters section fill out some of the options, then you can either Run the command directly from the pane or Insert the command into the Command Pane.

Give it a try out and see what you think.


Since writing this post, I noticed a new cmdlet Show-Command in the v3 preview. This will give you similar functionality to the Commands Add-on in the ISE.


You can also skip straight to the cmdlet you are interested in:

Show-Command -Name Get-Service


PowerShell v3 – Creating Objects With [pscustomobject] – it’s fast!

*****Warning. This is from a preview release******

PowerShell v2 brought the ability to create a custom object via the following method:

$CustomObject1 = New-Object psobject -Property @{a=1; b=2; c=3; d=4}

$CustomObject1 | Format-List

PowerShell v3 brings the possibility to create a custom object via


$CustomObject2 = [pscustomobject]@{a=1; b=2; c=3; d=4}

$CustomObject2 | Format-List



Note: both methods create a PSCustomObject with NoteProperties, not a hashtable object

$CustomObject1 | Get-Member

$CustomObject2 | Get-Member


So, why would you want to do it this way? Well firstly it preserves the insertion order, which helps with my OCD issues again. However, the main reason I have seen so far is that it is also a lot quicker. Fellow PowerShell MVP Tome Tanasovski carried out some basic performance testing which I thought I would highlight here.

There are four different ways you can create a custom object and a typical use case would be using PowerShell for reporting purposes, e.g. iterating through a list of VMs and pulling out various properties of them to create a report. With a very basic example, let’s have a look at the speed differences:

1) Select-Object

Not everybody knows that it’s possible to create a custom object with Select-Object. This was a handy trick since v1 days and was pretty quick too.

$TestSelect = {
(0..5000) | ForEach-Object {$CustomObject = "" | Select-Object Name,ID
$CustomObject.Name = "Test Name"
$CustomObject.ID = $_
Measure-Command $TestSelect | Format-Table TotalSeconds -Autosize

2) Add-Member

$TestAddMember = {
(0..5000) | ForEach-Object {$CustomObject = New-Object psobject
$CustomObject | Add-Member -Name "Name" -Value "Test Name"
$CustomObject | Add-Member -Name "ID" -Value $_
Measure-Command $TestAddMember | Format-Table TotalSeconds -Autosize


3) Property Parameter

$TestProperty = {
(0..5000) | ForEach-Object {New-Object psobject -Property @{Name = "Test Name"; ID = $_}}
Measure-Command $TestProperty | Format-Table TotalSeconds -Autosize



$TestPSCustomObject = {
(0..5000) | ForEach-Object {[pscustomobject]@{Name = "Test Name"; ID = $_}}
Measure-Command $TestPSCustomObject | Format-Table TotalSeconds -Autosize

So a summary of the these basic testing results looks pretty good for [pscustomobject]!

Select-Object = 7.74s

Add-Member = 28.87s

Property = 7.29

[pscustomobject] = 0.94s

I hope to try out [pscustomobject] on some of my reporting scripts and see what difference it makes to real world testing.

PowerShell v3 – Bringing [ordered] to your hashtables

*****Warning. This is from a preview release******

When using a hashtable in PowerShell v2 the insertion order is not preserved. So I might be slightly OCD, but this bugs me:

$HashTableOld = @{a=1; b=2; c=3; d=4}


If you consider the type of the object you will see that it is of .NET type System.Collections.Hashtable

$HashTableOld | Get-Member

In PowerShell v3 it is now possible to create an ordered hashtable using the [ordered] syntax

$HashTableNew = [ordered]@{a=1; b=2; c=3; d=4}


This will create an object of .NET type System.Collections.Specialized.OrderedDictionary

$HashTableNew | Get-Member

Possibly the most significant takeaway from this change is that it came as a feature suggestion from the community. Using http://connect.microsoft.com/PowerShell anybody can submit bugs / feature requests and gather community support for them via voting them up.If you have a good idea, then suggest itย  – you never know, it might make it into the product!

This feature suggestion came from Diogenus, more details can be found here.

Windows Server 8 – Now with PowerShell Cmdlets for DHCP

*****Warning. This is from a preview release******

In Windows Server 2008 R2 there were a number of modules included for managing typical server roles such as Active Directory, Failover Clustering etc. However, there were some noteable absentees, such as DHCP server.

You may ask why am I highlighting PowerShell cmdlets for DHCP, well:

  1. Fellow London VMUG regular Julian Wood commented on my PowerShell v3 First Look Post asking if there were DHCP cmdlets this time.
  2. Whether there are or not this time would indicate how cmdlet coverage is progressing.

So after firing up Windows Server Developer Preview it was good to see that there are now cmdlets for DHCP Server.

Firstly, add the DHCP Server Role:

Add-WindowsFeature DHCP

…and take a look at the DHCP server module.

Get-Module *DHCP* -ListAvailable

Now, let’s see how many cmdlets we have in that module:

(Get-Command -Module DHCPServer).count


So, let’s have a look at what kind of things we can do.

Get-Command -Module DHCPServer

Let’s try adding a new scope:

Add-DHCPServerv4Scope -Name "Test Scope" -StartRange -EndRange -SubnetMask

Now it’s also easy to report on that scope:

Get-DhcpServerv4Scope | Format-List *

The presence of the DHCP Server module is a good indicator that it is now pretty hard to ship a component of Windows Server without adding PowerShell support.

Hopefully 103 DHCP Server cmdlets is enough to make Julian happy ๐Ÿ™‚


Julian mentions in the comments about DHCP failover and loadbalancing. Haven’t had time to play with the technologies yet, but this might be a good indicator:

PowerShell ISE v3 – Now With IntelliSense

*****Warning. This is from a preview release******

Not everybody uses the PowerShell ISE as their primary script editor. However, if you do, or if you are using it to quickly edit a script not on your primary workstation then you will be pleased to see that in v3 it now has IntelliSense. In both the Input pane and the Script Editor.

From the Input pane:

This also works for commands in modules not loaded yet, such as Get-NetIPaddress. (See here for more details on that topic)

Script Editor:

Sneak peak:

Look out for an upcoming blogpost on this cool new PowerShell ISE v3 feature

PowerShell v3 – A Quick First Look

A preview (emphasis on the preview) of PowerShell v3 was made available in the early hours of this morning following the announcement at the Build conference. Apparently they are also planning to ship something with it called Windows 8. You can download the Windows Developer preview from MSDN to get an early look at it.

Well we know for sure that it is new:

and it is version 3:


And it is a .NET 4 app (CLRVersion)


From the standard PowerShell modules we have a total of 248 cmdlets

(Get-Command -Module Microsoft.PowerShell.*).count

However, there are a total of 239 modules that have shipped in the OS, though a large part of these are CIM based.

(Get-Module -ListAvailable -All).count

Excluding the CIM modules, there are 44 modules

Get-Module -ListAvailable

And obviously within each module there is plenty of good content:

Get-Command -Module PrintManagement

New Feature!

In previous versions of PowerShell if you needed to use a cmdlet from a module you first needed to import the module. In v3 the module is loaded when you type the command – even better, you get tab completion on the command before the module is loaded!

Note how the NetTCPIP module is loaded after a command from the module, Get-NetRoute, is loaded.


Get-NetRoute | Out-Null


Anyone think I should run a blog series called PowerShell 3.0 One Cmdlet at a Time? It might take a while….. ๐Ÿ˜‰