OSPoshMods PEPoshMods

For starters, PoshMods = PowerShell Modules ... so yes, you can easily add PowerShell Modules to WinPE and your OS using these ContentPacks. Since you should have added PowerShell using PEADK, why not update some Modules while you are at it

ContentPack Structure

Directories within OSPoshMods are created by default and follows this logical assignment

OSPoshMods\ProgramFiles
Content injects to OS at <Mount>\Program Files\WindowsPowerShell\Modules
OSPoshMods\System
Content injects to OS at <Mount>\Windows\System32\WindowsPowerShell\v1.0\Modules

Directories within PEPoshMods are created by default and follows this logical assignment

PEPoshMods\ProgramFiles
Content injects to WinPE at <Mount>\Program Files\WindowsPowerShell\Modules
PEPoshMods\System
Content injects to WinPE at <Mount>\Windows\System32\WindowsPowerShell\v1.0\Modules

Installed Modules

Let's first see what we have installed in Windows. You should have two PowerShell Modules directories that are used by default ... so let's see what is in them

C:\Program Files\WindowsPowerShell\Modules
C:\Windows\System32\WindowsPowerShell\v1.0\Modules

OS Program Files

These are some pretty old versions installed out of the box on Windows 10 1909

OS System32

Ok this looks a bit more complicated

WinSE Program Files

Just some old versions of PowerShellGet and PSReadline

WinSE System32

Nothing too out of the ordinary

Save-Module

Use the Save-Module cmdlet to easily add PowerShell Modules from PowerShell Gallery to the ContentPacks. Add the Verbose parameter for detailed results

Save-Module -Name OSD -Path D:\OSDBuilder\SeguraOSD\ContentPacks\_Global\OSPoshMods\ProgramFiles
Save-Module -Name OSD -Path D:\OSDBuilder\SeguraOSD\ContentPacks\_Global\PEPoshMods\ProgramFiles
Save-Module -Name PackageManagement -Path D:\OSDBuilder\SeguraOSD\ContentPacks\_Global\OSPoshMods\ProgramFiles
Save-Module -Name PackageManagement -Path D:\OSDBuilder\SeguraOSD\ContentPacks\_Global\PEPoshMods\ProgramFiles
Save-Module -Name Pester -Path D:\OSDBuilder\SeguraOSD\ContentPacks\_Global\OSPoshMods\ProgramFiles
Save-Module -Name PowerShellGet -Path D:\OSDBuilder\SeguraOSD\ContentPacks\_Global\OSPoshMods\ProgramFiles
Save-Module -Name PowerShellGet -Path D:\OSDBuilder\SeguraOSD\ContentPacks\_Global\PEPoshMods\ProgramFiles

Build

Simple enough, it's just a file copy ...

New-OSBuild -SkipTask -Execute -SkipComponentCleanup -SkipUpdates -CreateISO