我创建了一个PowerShell脚本,该脚本询问用户是否要安装Chocolatey,然后安装一堆应用程序并移动一些文件。
我在公司网络上使用了它,可惜的是,我们使用的代理设置带来了问题。当我执行Chocolatey脚本时,它说有一个错误,无法下载软件包。最烦人的是错误描述为“没有更多可用数据”。因此,在尝试运行脚本时,我在后台运行了Wireshark,并被告知该脚本正在尝试直接连接到不应该存在的盒子,这就是为什么它被拒绝的原因。
有人告诉我要解决此问题,我需要强制脚本退出端口80。我不知道该怎么做,因此一直在寻找有关实现此问题的建议。
我想这就像在:80
某个地方添加一样简单,但是,我已经尝试过了,没有运气。
#-Setting HTTP/S Proxy's-#
write-host "Configuring local proxy settings"
cscript configs\SetProxy_underscore.vbs
function Install-NeededFor {
param(
[string] $packageName = ''
,[bool] $defaultAnswer = $true
)
if ($packageName -eq '') { return $false }
$yes = '6'
$no = '7'
$msgBoxTimeout='-1'
$defaultAnswerDisplay = 'Yes'
$buttonType = 0x4;
if (!$defaultAnswer) { $defaultAnswerDisplay = 'No'; $buttonType= 0x104; }
$answer = $msgBoxTimeout
try {
$timeout = 10
$question = "Do you need to install $($packageName)? Defaults to `'$defaultAnswerDisplay`' after $timeout seconds"
$msgBox = New-Object -ComObject WScript.Shell
$answer = $msgBox.Popup($question, $timeout, "Install $packageName", $buttonType)
} catch {
}
if ($answer -eq $yes -or ($answer -eq $msgBoxTimeout -and $defaultAnswer -eq $true)) {
write-host "Installing $packageName"
return $true
}
write-host "Not installing $packageName"
return $false
}
#-install chocolatey-#
if (Install-NeededFor 'chocolatey') {
iex ((new-object net.webclient).DownloadString('http://chocolatey.org/install.ps1'))
}
choco install dotnet4.5 -y
cinst nuget.commandline -y
cinst chefdk -y
cinst notepadplusplus -y
cinst vagrant -y
cinst vagrant-winrm-config -y
cinst virtualbox -version 4.3.12 -y
choco install virtualbox -version 4.3.12 -y
cinst atom -y
cinst putty -y
cinst winscp -y
cinst conemu -y
cinst launchy -y
cinst everything -y
choco install git.install -y -params '"/GitAndUnixToolsOnPath"'
choco install git-credential-winstore -y
vagrant plugin install vagrant-berkshelf
vagrant plugin install vagrant-proxyconf
vagrant plugin install vagrant-omnibus
目前,0.9.9系列似乎不适用于代理-请关注https://github.com/chocolatey/choco/issues/243,以了解何时以及何时修复该版本。谢谢!
您也可以坚持使用0.9.8.33,直到修复程序出现为止-我们甚至可以为您提供安装旧客户端的方法-https: //github.com/chocolatey/chocolatey.org/issues/162
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句