Skip to content

Windows PowerShell 5.1

Michael Escamilla edited this page Sep 5, 2025 · 7 revisions

Walkthrough Video

Below is a video walkthrough of the steps on this page:

OSDWorkspace Prerequisites: PowerShell 5.1

Set the Execution Policy to RemoteSigned

Set the execution policy to allow running local and remote scripts:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine -Force

Install the NuGet Package Provider

NuGet is required for interacting with the PowerShell Gallery and managing modules. Install it if not already present:

if ($(Get-PackageProvider).Name -notcontains 'NuGet') {
    Install-PackageProvider -Name NuGet -Force -Verbose
}

Trust the PowerShell Gallery

Set the PowerShell Gallery (PSGallery) as a trusted repository to avoid confirmation prompts during module installation:

if ((Get-PSRepository -Name 'PSGallery').InstallationPolicy -ne 'Trusted') {
    Set-PSRepository -Name 'PSGallery' -InstallationPolicy Trusted
    Write-Host "PowerShell Gallery (PSGallery) has been set to Trusted."
} else {
    Write-Host "PowerShell Gallery (PSGallery) is already Trusted."
}

Update PowerShellGet

Install-Module -Name PowerShellGet -Force -Scope AllUsers -AllowClobber -SkipPublisherCheck -Verbose

Update PackageManagement

This should have been updated as part of PowerShellGet, but if you encounter issues, you can run the following command to ensure it is up to date:

Install-Module -Name PackageManagement -Force -Scope AllUsers -AllowClobber -SkipPublisherCheck -Verbose

Clone this wiki locally