Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I install PSCX Powershell module?

I'm running Windows 7 with PowerShell 2 installed.

I've downloaded version 2.1 from here - http://pscx.codeplex.com/releases

The Release notes say

  • unblock the zip file - {which I did}
  • extract the contents of the ZIP file to your $env:Home\Documents\WindowsPowerShell\Modules folder

I was unsure what $env:Home was so a bit of searching determined that the release notes are expecting an environment variable called Home which doesn't exist on my machine.

A bit more searching says use what is defined as ~ on my machine. So in a PS prompt I run cd ~

Which on my machine led to a network drive U:

I created the following directories U:\Documents\WindowsPowerShell\Modules and copied the extracted Pscx-2.1.0 to the Modules folder. Opened a PowerShell prompt and typed Get-Module -ListAvailable. This didn't give me Pscx in the results.

The above steps actually gave me this folder tree U:\Documents\WindowsPowerShell\Modules\Pscx-2.1.0\Pscx-2.1.0

So I copied the files up a level and tried again with U:\Documents\WindowsPowerShell\Modules\Pscx-2.1.0\ and also tried with U:\Documents\WindowsPowerShell\Modules\Pscx\

I also tried all of the above with this path U:\WindowsPowerShell\Modules\Pscx-2.1.0\

I'm guessing that the Modules aren't actually supposed to be in this directory, so a bit more searching leads to this command. (Get-ChildItem Env:\PSModulePath).Value

which gives the following result

C:\Users\my.name\Documents\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules\

So I copy the Pscx-2.1.0 folder to here C:\Users\my.name\Documents\WindowsPowerShell\Modules\Pscx-2.1.0

And still no luck.

What step am I missing?

like image 414
Paul Rowland Avatar asked Dec 07 '12 00:12

Paul Rowland


People also ask

How do I manually install PowerShell modules?

To install PowerShell modules manually, you first need to determine your current PowerShell module directory path, download your new module to that path, and invoke the import-module command to let windows know it's there.

How do I install latest PowerShell module?

To manually install the latest version of the PowerShell module, there are two methods. Use the -RequiredVersion parameter if you know the latest version of the module. Use the -MinimumVersion parameter if you know the minor version of the module and it will pick up the latest version.

What is Pscx module?

PowerShell Community Extensions (PSCX) base module which implements a general purpose set of Cmdlets.


2 Answers

I hadn't actually completed the last step of my above question completely which turned out to be the answer.

Here is that answer for completeness

  • Unblock the zip file you have downloaded
  • extract the zip file - this will likely give a folder structure of Pscx-2.1.0/Pscx-2.1.0/{lots of files}
  • rename the child folder to Pscx - ie - Pscx-2.1.0/Pscx/{lots of files}
  • In Powershell prompt run (Get-ChildItem Env:\PSModulePath).Value and note the modules folder location.
  • Copy the child Pscx folder to the Modules folder location given above.
  • In Powershell prompt run Get-Module -ListAvailable to see the Pscx module available.
like image 160
Paul Rowland Avatar answered Oct 05 '22 23:10

Paul Rowland


In PowerShell 5.0, you can do:

Find-Package pscx | ? ProviderName -eq PSModule | Install-Package -Force

The -Force parameter will cause it to upgrade if an older version is already installed.

In PowerShell 5.1, you'll need:

Find-Package pscx | ? ProviderName -eq PowerShellGet | Install-Package -Force

or

Find-Package pscx -ProviderName PowerShellGet | Install-Package -Force

or just

Install-Package pscx -Force
like image 45
orad Avatar answered Oct 06 '22 00:10

orad