#pscore6 v.s. #powershell 5.x Modules (Part III)

You must have already noticed discrepancies in modules and corresponding commands[1] between PowerShell versions and releases. How can I keep abreast with constant changes in today’s ever fast-pace cloud technologies now that PowerShell is cross-platform commencing with version 6.x?

One way to find out yourself is illustrated here, paying attention to compare apples to apples i.e. Windows Desktop v.s. Windows Desktop. Otherwise, a big difference is to be expected between Windows Server 2016 and Windows 10 Desktop platforms running PowerShell 5.1.x for instance.

STEP 1: export a list of available modules for each #powershell version/release

$mod = @{};
Get-Module -ListAvailable | % { $mod[$PsItem.name] = $PsItem.ExportedCommands }

$mod | Export-Clixml modules-la1-w2016ps5.10.xml #computer A
$mod | Export-Clixml modules-la1-w2016ps6.0.0.xml #computer B

STEP 2: import the saved xml data on computer A or B

$mps5 = Import-Clixml .\modules-la1-w2016ps5.10.xml
$mps6 = Import-Clixml .\modules-la1-w2016ps6.0.0.xml

STEP 3: make a comparison to identify any differences

$diffmodules = diff $mps5.keys $mps6.keys
$diffmodulesInObj = diff $diffmodules[0].InputObject $diffmodules[1].InputObject

diff ($diffmodulesInObj[0].InputObject | % { $_ }) ($diffmodulesInObj[1].InputObject | % { $_ } ) | sort inputobject

InputObject SideIndicator
———– ————-
AppBackgroundTask <=
AppLocker <=
AppvClient <=
Appx <=
AssignedAccess <=
BestPractices <=
BitsTransfer <=
BranchCache <=
ConfigCI <=

 

[1] functions, cmdlets, aliases, etc.

Leave a Reply