-
Notifications
You must be signed in to change notification settings - Fork 8
Windows PowerShell 5.1
David Segura - PowerShell MVP edited this page May 16, 2025
·
7 revisions
This guide provides step-by-step instructions to configure Windows PowerShell 5.1 for use with OSDWorkspace and the PowerShell Gallery. Follow these steps to ensure your environment is ready for module installation and management.
Set the execution policy to allow running local and remote scripts:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine -ForceNuGet 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
}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."
}Install or update the following modules to ensure compatibility and access to the latest features:
Install-Module -Name PowerShellGet -Force -Scope AllUsers -AllowClobber -SkipPublisherCheck -VerboseInstall-Module -Name PackageManagement -Force -Scope AllUsers -AllowClobber -SkipPublisherCheck -VerboseNote:
- Run PowerShell as Administrator for all steps above.
- These steps are required for OSDWorkspace and other advanced module management scenarios.