Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
安装PowerShellGet模块_Powershell - Fatal编程技术网

安装PowerShellGet模块

安装PowerShellGet模块,powershell,Powershell,我正在使用Windows 2012 R2,它运行的是PowerShell 4.0版。我已升级到5.0版 比如,当我执行基本命令时,会出现错误 PS C:\Windows\system32> Install-Module –Name PowerShellGet –Force –Verbose 安装模块:在模块中找到“安装模块”命令 “PowerShellGet”,但无法加载模块。更多 有关详细信息,请运行“导入模块PowerShellGet”。第1行字符:1 +安装模块–名称PowerSh

我正在使用Windows 2012 R2,它运行的是PowerShell 4.0版。我已升级到5.0版

比如,当我执行基本命令时,会出现错误

PS C:\Windows\system32> Install-Module –Name PowerShellGet –Force –Verbose
安装模块:在模块中找到“安装模块”命令 “PowerShellGet”,但无法加载模块。更多 有关详细信息,请运行“导入模块PowerShellGet”。第1行字符:1 +安装模块–名称PowerShellGet–强制–详细 + ~~~~~~~~~~~~~~ +CategoryInfo:ObjectNotFound:(安装模块:String)[],CommandNotFoundException +FullyQualifiedErrorId:无法自动加载匹配模块

另一个例子:

PS C:\Windows\system32> import-module PowerShellGet
Get Variable:术语“Get Variable”未被识别为名称 指cmdlet、函数、脚本文件或可操作程序。检查 名称的拼写,或者如果包含路径,请验证路径 是正确的,请重试。在C:\程序中 文件\WindowsPowerShell\Modules\PowerShellGet\1.1.3.2\PSModule.psm1:18 字符:28 +$script:IsWindows=(-not(获取变量名-IsWindows-ErrorAction。。。 + ~~~~~~~~~~~~ +CategoryInfo:ObjectNotFound:(获取变量:String)[],CommandNotFoundException +FullyQualifiedErrorId:CommandNotFoundException

我基本上遵循这里的PowerShellGet安装方法:


我被本指南中的“安装模块”命令卡住了。

在您的powershell上执行命令:“设置ExecutionPolicy Unrestricted”,然后再执行安装模块。
(受限模式可帮助您防止未经授权的脚本)

嗨,Geoff,欢迎使用SO!请花点时间研究一下,以改进您的问题和格式: