如何安装 PSCX Powershell 模块? [英] How do I install PSCX Powershell module?

查看:39
本文介绍了如何安装 PSCX Powershell 模块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我运行的是安装了 PowerShell 2 的 Windows 7.

I'm running Windows 7 with PowerShell 2 installed.

我从这里下载了 2.1 版 - http://pscx.codeplex.com/releases

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

发行说明说

  • 取消阻止 zip 文件 - {我做了}
  • 将 ZIP 文件的内容解压缩到您的 $env:Home\Documents\WindowsPowerShell\Modules 文件夹

我不确定 $env:Home 是什么,所以经过一番搜索确定发行说明需要一个名为 Home 的环境变量,但我的机器上不存在该变量.

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.

多一点搜索说在我的机器上使用定义为 ~ 的内容.所以在 PS 提示中我运行 cd ~

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

在我的机器上导致网络驱动器 U:

Which on my machine led to a network drive U:

我创建了以下目录 U:\Documents\WindowsPowerShell\Modules 并将提取的 Pscx-2.1.0 复制到 Modules 文件夹.打开 PowerShell 提示符并键入 Get-Module -ListAvailable.这在结果中没有给我 Pscx.

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.

上述步骤实际上给了我这个文件夹树U:\Documents\WindowsPowerShell\Modules\Pscx-2.1.0\Pscx-2.1.0

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

所以我将文件复制了一个级别并再次尝试使用 U:\Documents\WindowsPowerShell\Modules\Pscx-2.1.0\ 并尝试使用 U:\Documents\WindowsPowerShell\Modules\Pscx\

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\

我还使用此路径尝试了上述所有操作U:\WindowsPowerShell\Modules\Pscx-2.1.0\

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

我猜模块实际上不应该在这个目录中,所以更多的搜索会导致这个命令.(Get-ChildItem Env:\PSModulePath).Value

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

得到以下结果

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

所以我将 Pscx-2.1.0 文件夹复制到这里 C:\Users\my.name\Documents\WindowsPowerShell\Modules\Pscx-2.1.0

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

仍然没有运气.

我遗漏了哪一步?

推荐答案

我实际上还没有完全完成上述问题的最后一步,结果就是答案.

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

这是完整性的答案

  • 取消阻止您下载的 zip 文件
  • 提取 zip 文件 - 这可能会给出 Pscx-2.1.0/Pscx-2.1.0/{lots of files}
  • 的文件夹结构
  • 将子文件夹重命名为 Pscx - 即 - Pscx-2.1.0/Pscx/{lots of files}
  • 在 Powershell 提示符下运行 (Get-ChildItem Env:\PSModulePath).Value 并记下模块文件夹的位置.
  • child Pscx 文件夹 复制到上面给出的 Modules 文件夹位置.
  • 在 Powershell 提示符下运行 Get-Module -ListAvailable 以查看可用的 Pscx 模块.
  • 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.

这篇关于如何安装 PSCX Powershell 模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆