8

How to find out what’s new in PowerShell vNext

Windows 8 Developer Preview (pre-beta version) was released for public at the BUILD conference (you can download it HERE) and it is packaged with PowerShell v3 and a ton of goodies! One aspect that I usually check when a new version is released is which new cmdlets were added and what parameters has been added or removed.

To find all the changes between the two versions of PowerShell (v2 and v3) I put together a script that produces a list of commands and parameters. To compare the changes I run a command, on each version of PowerShell , that exports all core cmdlets (cmdlet name and a list of parameters) to an XML file using the Export-CliXml cmdlet.

Once the XML files have been created I import them back using the Import-CliXml cmdlet and then look at the differences. The script can be used, with some modifications, to find differences in other areas too- aliases, automatic and environment variables, specific module cmdlets and so on. Take the time to experiment with it.

 

UPDATE

There seems to be an issue with the command I used to export cmdlets and parameters in Windows 8 (works fine in v2).
For some reason, some cmdlets do not have a value in the Parameters column.
To resolve this I modified the expression to get the parameters and added a second call to Get-Command.
The new expression I used (post code is updated as well as the result).  @mjolinor, thanks :for the comment!

Get-Command -Module Microsoft.PowerShell.*, Microsoft.WSMan.* | Select-Object -Property Name,@{Name=’Parameters’;Expression={(Get-Command $_).Parameters.Keys}}

The old expression was: … ;Expression={$_.Parameters.Keys}}

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# run in v2, export all core cmdlets, name and parameters
Get-Command -Module Microsoft.PowerShell.*, Microsoft.WSMan.* | Select-Object-PropertyName,@{Name=’Parameters’;Expression={(Get-Command $_).Parameters.Keys}} | Export-Clixml.\v2.xml

# run in v3, export all core cmdlets, name and parameters
Get-Command -Module Microsoft.PowerShell.*, Microsoft.WSMan.* | Select-Object-PropertyName,@{Name=’Parameters’;Expression={(Get-Command $_).Parameters.Keys}} | Export-Clixml.\v3.xml

# run either in v2 or v3 console
$v2 = Import-CliXml .\v2.xml | Sort-Object -Property Name
$v3 = Import-CliXml .\v3.xml | Sort-Object -Property Name

Compare-Object $v2 $v3 -Property Name -IncludeEqual -PassThru | ForEach-Object {

    $Command = $_

    if($_.SideIndicator -eq ‘==’)
    {
        $Command = $_

        $cv2 = $v2 | Where-Object {$_.Name -eq $Command.Name} | Select-Object -ExpandProperty Parameters
        $cv3 = $v3 | Where-Object {$_.Name -eq $Command.Name} | Select-Object -ExpandProperty Parameters

        $compare = Compare-Object $cv2 $cv3

        if($compare)
        {
            try
            {
                $NewParameters = $compare | Where-Object {$_.SideIndicator -eq ‘=>’} | ForEach-Object {$_.InputObject + ‘ (+)’}
                $RemovedParameters = $compare | Where-Object {$_.SideIndicator -eq ‘<=’} | ForEach-Object {$_.InputObject + ‘ (-)’}

                “$($command.Name) (!)”
                $NewParameters + $RemovedParameters | Sort-Object | ForEach-Object { “`t$_”}
                “`n”
            }
            catch{}
        }
    }
    elseif($_.SideIndicator -eq ‘=>’)
    {
        “$($Command.name) (+)`n”
    }
    else
    {
        “$($Command.name) (-)`n”
    }
}

Here’s the result. Yummy! :)

Legend
——–
!  > Changed
+ > New
-  > Removed

Add-Computer (!)
ComputerName (+)
Force (+)
LocalCredential (+)
NewName (+)
Options (+)
Restart (+)
UnjoinDomainCredential (+)Add-Content (!)
Stream (+)Add-Member (!)
NotePropertyMembers (+)
NotePropertyName (+)
NotePropertyValue (+)
TypeName (+)

Add-Type (!)
LiteralPath (+)

Clear-Content (!)
Stream (+)

Export-Alias (!)
LiteralPath (+)

Export-Clixml (!)
LiteralPath (+)

Export-Csv (!)
Append (+)
LiteralPath (+)

Export-FormatData (!)
LiteralPath (+)

Export-PSSession (!)
Certificate (+)

ForEach-Object (!)
ArgumentList (+)
Confirm (+)
MemberName (+)
RemainingScripts (+)
WhatIf (+)

Get-Acl (!)
AllCentralAccessPolicies (+)
InputObject (+)
LiteralPath (+)

Get-AuthenticodeSignature (!)
LiteralPath (+)

Get-ChildItem (!)
Attributes (+)
Directory (+)
File (+)
Hidden (+)
ReadOnly (+)
System (+)

Get-Command (!)
All (+)

Get-Content (!)
Raw (+)
Stream (+)
Tail (+)

Get-Date (!)
Millisecond (+)

Get-Item (!)
Stream (+)

Get-Job (!)
After (+)
Before (+)
Filter (+)
Newest (+)

Get-Module (!)
Authentication (+)
CimSession (+)
ComputerName (+)
Credential (+)
PSSession (+)

Get-PfxCertificate (!)
LiteralPath (+)

Get-PSSession (!)
Authentication (+)
CertificateThumbprint (+)
Credential (+)
Port (+)
State (+)
ThrottleLimit (+)
UseSSL (+)

Import-Alias (!)
LiteralPath (+)

Import-Clixml (!)
First (+)
IncludeTotalCount (+)
LiteralPath (+)
Skip (+)

Import-Csv (!)
Encoding (+)
LiteralPath (+)

Import-LocalizedData (!)
PassThru (+)

Import-Module (!)
AsWorkflow (+)
Authentication (+)
CimSession (+)
ComputerName (+)
Credential (+)
MinimumVersion (+)
NoClobber (+)
PSSession (+)
RequiredVersion (+)
Scope (+)
Version (-)

Import-PSSession (!)
Certificate (+)

Invoke-Command (!)
Disconnected (+)
SessionName (+)

New-ModuleManifest (!)
DefaultCommandPrefix (+)
DependentWorkflows (+)
ExportAsWorkflow (+)
HelpInfoUri (+)
ModuleToProcess (-)
RootModule (+)
WorkflowsToProcess (+)

New-PSSessionOption (!)
OutputBufferingMode (+)

Out-File (!)
LiteralPath (+)

Out-GridView (!)
Block (+)
OutputMode (+)
PassThru (+)

Receive-Job (!)
Wait (+)
WriteEvents (+)
WriteJobInResults (+)

Register-PSSessionConfiguration (!)
AccessMode (+)
ModulePath (+)
Path (+)
PSVersion (+)
RunAsCredential (+)
SessionType (+)
SessionTypeOption (+)
TransportOption (+)
UseSharedProcess (+)

Remove-Computer (!)
ComputerName (+)
Credential (-)
LocalCredential (+)
Restart (+)
UnjoinDomainCredential (+)
Workgroup (+)

Remove-Item (!)
Stream (+)Remove-Job (!)
Filter (+)Rename-Item (!)
LiteralPath (+)

Reset-ComputerMachinePassword (!)
Credential (+)

Restart-Computer (!)
Delay (+)
For (+)
Timeout (+)
Wait (+)

Select-Object (!)
Wait (+)

Select-String (!)
LiteralPath (+)

Select-Xml (!)
LiteralPath (+)

Set-Acl (!)
CentralAccessPolicy (+)
ClearCentralAccessPolicy (+)
InputObject (+)
LiteralPath (+)
SecurityDescriptor (+)

Set-AuthenticodeSignature (!)
LiteralPath (+)

Set-Content (!)
Stream (+)

Set-PSSessionConfiguration (!)
AccessMode (+)
ModulePath (+)
PSVersion (+)
RunAsCredential (+)
SessionType (+)
SessionTypeOption (+)
TransportOption (+)
UseSharedProcess (+)

Set-WSManQuickConfig (!)
SkipNetworkProfileCheck (+)

Start-Job (!)
DefinitionName (+)
DefinitionPath (+)
DefinitionType (+)
LiteralPath (+)
PSVersion (+)
WriteToStore (+)

Start-Transcript (!)
LiteralPath (+)

Stop-Job (!)
Filter (+)

Tee-Object (!)
Append (+)
LiteralPath (+)

Test-Path (!)
NewerThan (+)
OlderThan (+)

Update-TypeData (!)
DefaultDisplayProperty (+)
DefaultDisplayPropertySet (+)
DefaultKeyPropertySet (+)
Force (+)
InheritPropertySerializationSet (+)
InputObject (+)
MemberName (+)
MemberType (+)
PropertySerializationSet (+)
SecondValue (+)
SerializationDepth (+)
SerializationMethod (+)
StringSerializationSource (+)
TargetTypeForDeserialization (+)
TypeAdapter (+)
TypeConverter (+)
TypeData (+)
Value (+)

Wait-Job (!)
Filter (+)

Where-Object (!)
CContains (+)
CEQ (+)
CGE (+)
CGT (+)
CIn (+)
CLE (+)
CLike (+)
CLT (+)
CMatch (+)
CNE (+)
CNotContains (+)
CNotIn (+)
CNotLike (+)
CNotMatch (+)
Contains (+)
EQ (+)
GE (+)
GT (+)
In (+)
Is (+)
IsNot (+)
LE (+)
Like (+)
LT (+)
Match (+)
NE (+)
NotContains (+)
NotIn (+)
NotLike (+)
NotMatch (+)
Property (+)
Value (+)

Connect-PSSession (+)

ConvertFrom-Json (+)

ConvertTo-Json (+)

Disable-PSRemoting (+)

Disconnect-PSSession (+)

Export-CimCommand (+)

Get-ControlPanelItem (+)

Get-TypeData (+)

Invoke-RestMethod (+)

Invoke-WebRequest (+)

New-PSSessionConfigurationFile (+)

New-PSTransportOption (+)

New-WinEvent (+)

Receive-PSSession (+)

Register-JobEvent (+)

Remove-TypeData (+)

Rename-Computer (+)

Resume-Job (+)

Save-Help (+)

Show-Command (+)

Show-ControlPanelItem (+)

Suspend-Job (+)

Test-PSSessionConfigurationFile (+)

Unblock-File (+)

Update-Help (+)

Filed in: Articles, Online Only Tags: , ,

4 Pingbacks/Trackbacks

© 2014 PowerShell Magazine. All rights reserved. XHTML / CSS Valid.
Proudly designed by Theme Junkie.
%d bloggers like this: