3

I want to install the PowerShell Community Extensions using only the command-line.

I don't want to use a UI, no right-click extract, double-clicking an MSI file. I have to do this process on dozens of computers. However, all of the instructions I've found involve all of this clicking and downloading.

I'm looking for a series of PowerShell commands that can complete the installation. Ideal solution would be completely self-contained: download file X & install. I would like to avoid copying local versions to the given server.

Requirement of Admin access is fine.


Clarifications:

  • I'm starting from a blank computer, with PoSH 2.0 installed. I'm logged in via PsSession.
  • I'm looking for a series of PoSH commands, not a list of instructions.
  • I'm actively trying to avoid "Open IE and download a file", that's the anti-thesis of a shell.

Edit for 2014

I would now do this with Chocolatey.

Chocolatey has a one-line download & install command followed by an additional command in to install PSCX.

Gates VP
  • 44,957
  • 11
  • 105
  • 108
  • you are writting about dozens of computers, haveyou got a domain ? – JPBlanc Oct 23 '11 at 05:21
  • Some of the computers I'm working with right now *are* on a domain. But I also have a few boxes *not* on that domain. – Gates VP Oct 23 '11 at 08:16
  • Based on the edit - You want people to give you exact script in Powershell when you haven't tried out ANYTHING, not even downloaded the PSCX zip to see the instructions on how to install. See questions here on how to download files, how to unzip, how to invoke on multiple commands etc. – manojlds Oct 23 '11 at 08:32
  • So, I've tried several things, but all of them involve some series of previously downloaded scripts. So I have to build a `wget`/`curl`, then I have to download 7z just so I can get a `tar` and *then* I can start downloading extensions? Is there not some type of `nuget` or `apt-get` or generalized plug-in installer for PoSH? – Gates VP Oct 28 '11 at 19:18
  • any final solution with full source code ? – Kiquenet Feb 20 '13 at 14:05
  • no final solution, it looks like PowerShell is really hurting for a real package manager... which is really unfortunate, because that would be a big step forward for command-line tools – Gates VP Feb 20 '13 at 19:41

1 Answers1

4

PSCX (2.0) is available as a zip and all you have to do is copy the contents of the zip file to your modules folder -$env:Home\Documents\WindowsPowerShell\Modules ( for user) or $PSHome\Modules (for system) - and when you want to use it, issue import-module pscx.

Read the release notes for more details.

manojlds
  • 290,304
  • 63
  • 469
  • 417
  • Thank you for this, but it still sounds like I am manually downloading and unzipping the files. Any idea how I download and unzip the files with PoSH? – Gates VP Oct 22 '11 at 00:27
  • 4
    Download using `system.net.webclient`. Unzip using `7z.exe` commandline tools or some other commandline zip tool. – manojlds Oct 22 '11 at 00:30
  • @manojlds If I follow your instructions, I get this error: Import-Module : Could not load file or assembly 'file:///C:\Windows\system32\WindowsPowerShell\v1.0\Modules\pscx\Pscx.dll' or one of its dependencies. Ope not supported. (Exception from HRESULT: 0x80131515) At line:1 char:1 + import-module pscx + ~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [Import-Module], FileLoadException + FullyQualifiedErrorId : FormatXmlUpdateException,Microsoft.PowerShell.Commands.ImportModuleCommand – IgorGanapolsky Aug 13 '12 at 13:27