LogoLogo
TwitterLinkedInGitHubPowerShell Gallery
  • About
  • Events
  • Blog
    • 2022
      • 🆕OSD January Update
      • 🆕PSCloudScript Basics
    • 2021
      • Start-OOBEDeploy
      • OSDCloud
      • PowerShell Gallery in WinPE
      • BitLocker KeyProtectors
      • WindowsCapability -and WindowsPackage
      • Scheduled Tasks
        • Building a Task
        • Task Permissions
        • Task Trigger
        • Action a PowerShell File
        • Action a PS Encoded Script
        • Conclusion
          • Windows Activation and Edition Change
          • REG.exe and Multiple Actions
    • 2019
      • 2019-02
        • Offline Servicing vs Reference Image
      • 2019-04
        • Windows 10 Upgrade MultiLang (Uno)
      • 2019-06
        • Offline Servicing Windows 10 with CU for .NET 4.8
        • OSDBuilder and .NET CU KB4480056
      • 2019-09
        • Black Screen During Windows 10 Setup
      • 2019-11
        • I Hate OSDBuilder
    • 2018
      • WinPE 10 1809 WPF DLL Fix
      • Microsoft Update Releases
      • Create WinPE.wim from Boot.wim or WinRE.wim
      • Windows Setup: FAT32 USB with +4GB Install.wim
      • Windows 10 from ESD
      • Windows 10 1809 Appx Issues
      • Mount-WindowsImage -Optimize
  • Guides
    • Autopilot App Registration
    • PSCloudScript
      • PS Cmdlets
      • GitHub Gist
      • GitHub Git Repo
      • Content-Type | Azure Static Web App
      • Command Shortening
      • Azure Key Vault Secret
      • OSD PowerShell Module
      • PSCloudScript Examples
        • Autopilot
        • AutopilotOOBE
        • OSDCloud Live
        • WinPE PowerShell Gallery
        • OSDCloud WinPE and OOBE
    • go OSDCloud
      • Azure Function
      • Custom Domain
      • SSL Binding
      • Proxies
  • PowerShell
    • OSD
    • OSDCloud
    • OSDBuilder (Offline Servicing)
    • OSDSUS (Update Catalogs)
    • OSDUpdate (MS Updates)
    • OSDDrivers (Compact Drivers)
    • PShot
      • Release Notes
      • Usage
        • -Directory
        • $AutoPath
        • -Prefix
        • -Count
        • -Delay
        • -Clipboard
        • -Primary
        • The Object
      • Technical
        • Why a Module?
        • Resolution, Scale and DPI
Powered by GitBook
On this page
  • No PackageManagement
  • No LocalAppData
  • The Function
  • Results
  1. Blog
  2. 2021

PowerShell Gallery in WinPE

March 8, 2021

PreviousOSDCloudNextBitLocker KeyProtectors

Last updated 3 years ago

It would be nice if you could install PowerShell Modules in WinPE from PowerShell Gallery ... here is how

No PackageManagement

The first problem is that even though PowerShellGet is installed in WinPE, PackageManagement is not. This leads to a Chicken and Egg situation where you can't install PackageManagement from PowerShell Gallery until PackageManagement is installed

No LocalAppData

So you manage to get a copy of the PackageManagement PowerShell Module saved in your WinPE WIM, but things still don't work. This is because WinPE does not contain a Volatile Environment at HKEY_CURRENT_USER\Volatile Environment

Specifically, what is missing is LOCALAPPDATA

The Function

I ended up writing a function that will make these changes for you. Feel free to have a look

What this function does is

  1. Mounts a WinPE WIM

  2. Adds the missing Volatile Environment (in Current Environment)

  3. Saves PackageManagenment and PowerShellGet Modules from PowerShell Gallery in the WIM

  4. Dismount and Save the WinPE WIM

Results

After modifying the WIM, I can test the changes by creating an ISO (or you can USB, whatever). Works like a champ!

​

​

​

Enable-PEWimPSGalleryOSD
Logo