Skip to content


Subversion checkout URL

You can clone with
Download ZIP
tree: 64e8d79b6d
Fetching contributors…

Cannot retrieve contributors at this time

54 lines (46 sloc) 2.159 kb
function Install-PsGet {
$ModulePaths = @($Env:PSModulePath -split ';')
# $PsGetDestinationModulePath is mostly needed for testing purposes,
if ((Test-Path -Path Variable:PsGetDestinationModulePath) -and $PsGetDestinationModulePath) {
$Destination = $PsGetDestinationModulePath
if ($ModulePaths -notcontains $Destination) {
Write-Warning 'PsGet install destination is not included in the PSModulePath environment variable'
} else {
$ExpectedUserModulePath = Join-Path -Path ([Environment]::GetFolderPath('MyDocuments')) -ChildPath WindowsPowerShell\Modules
$Destination = $ModulePaths | Where-Object { $_ -eq $ExpectedUserModulePath}
if (-not $Destination) {
$Destination = $ModulePaths | Select-Object -Index 0
New-Item ($Destination + "\PsGet\") -ItemType Directory -Force | out-null
Write-Host Downloading PsGet from
$client = (New-Object Net.WebClient)
$client.Proxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials
$client.DownloadFile("", $Destination + "\PsGet\PsGet.psm1")
$executionPolicy = (Get-ExecutionPolicy)
$executionRestricted = ($executionPolicy -eq "Restricted")
if ($executionRestricted){
Write-Warning @"
Your execution policy is $executionPolicy, this means you will not be able import or use any scripts including modules.
To fix this change you execution policy to something like RemoteSigned.
PS> Set-ExecutionPolicy RemoteSigned
For more information execute:
PS> Get-Help about_execution_policies
if (!$executionRestricted){
# ensure PsGet is imported from the location it was just installed to
Import-Module -Name $Destination\PsGet
Write-Host "PsGet is installed and ready to use" -Foreground Green
Write-Host @"
PS> import-module PsGet
PS> install-module PsUrl
For more details:
get-help install-module
Or visit
Jump to Line
Something went wrong with that request. Please try again.