Monthly Archive

Categories

Module confusion–what’s really in PowerShell 3 and 4

If I run

Get-Module –ListAvailable

on my Windows 8.1 system (PowerShell 4.0) I find a total of 58 modules installed in $pshome\modules i.e. C:\windows\system32\WindowsPowerShell\v1.0\Modules

These are the modules installed as part of PowerShell. Right?

Wrong?

Compare this with a Windows 7 machine that’s been upgraded to PowerShell 4.0.  Repeating the exercise I find a grand total of 15 modules.

So where has the other 75% of my functionality gone. 

This is the breakdown down of the modules installed on the Windows 7 machine  - terminology is mine (feel free to disagree with the groupings).

Core PowerShell:

Microsoft.PowerShell.Diagnostic
Microsoft.PowerShell.Host
Microsoft.PowerShell.Management
Microsoft.PowerShell.Security
Microsoft.PowerShell.Utility
CimCmdlets
ISE
Microsoft.WSMan.Management

File Transfer module

BitsTransfer

Troubleshooting:

PSDiagnostics
TroubleshootingPack

Other related engines:

PSDesiredStateConfiguration
PSScheduledJob
PSWorkflow
PSWorkflowUtility

and that’s it. Everything else as far as I can determine is CDXML based and therefore can’t be made available on legacy systems. The following modules are included in that category:

AppBackgroundTask
AppLocker
Appx
AssignedAccess
BitLocker
BranchCache
Defender
DirectAccessClientComponents
Dism
DnsClient
International
iSCSI
Kds
MMAgent
MsDtc
NetAdapter
NetConnection
NetEventPacketCapture
NetLbfo
NetNat
NetQos
NetSecurity
NetSwitchTeam
NetTCPIP
NetWNV
NetworkConnectivityStatus
NetworkTransition
PcsvDevice
PKI
PrintManagement
ScheduledTasks
SecureBoot
SmbShare
SmbWitness
StartScreen
Storage
TLS
TrustedPlatformModule
VpnClient
Wdac
WindowsDeveloperLicense
WindowsErrorReporting
WindowsSearch

A CDXML based module is produced by taking a CIM (WMI) class and wrapping it in some simple XML and saving it as a .cdxml file. This can then be published as a PowerShell module. The CIM classes won’t be made available on downlevel systems so you won’t find this functionality on anything earlier than Windows 8/2012.

If you need the functionality supplied by these modules you will either have to use the old command line tools or a WMI class – much of the functionality of the NetAdapter and NETCPIP modules for instance can be duplicated using Win32_NetworkAdapter and Win32_NetworkAdapterConfiguration..

Leave a Reply