首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在巧克力包安装脚本中指定端口?

如何在巧克力包安装脚本中指定端口?
EN

Stack Overflow用户
提问于 2015-05-28 19:46:31
回答 1查看 843关注 0票数 1

我创建了一个PowerShell脚本,询问用户是否想安装巧克力,然后安装一堆应用程序并移动一些文件。

我在公司网络上使用这个,不幸的是,我们使用的代理设置带来了问题。当我执行巧克力脚本,它说有一个错误,它不能下载的包。最恼人的是错误描述是“没有更多的数据可用”。因此,当我试图运行脚本时,我在后台运行Wireshark,并被告知脚本正在尝试直接连接到一个不应该出现的框,这就是它被拒绝的原因。

我被告知要修复这个问题,我需要强制脚本离开端口80。我不知道该怎么做,所以我在寻求一些关于如何实现这一目标的建议。

我认为它就像在某个地方添加:80一样简单,但是,我已经尝试过了,但是没有运气。

代码语言:javascript
复制
#-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
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-06-10 01:28:24

现在,0.9.9系列似乎不能很好地发挥代理-跟随https://github.com/chocolatey/choco/issues/243来了解什么时候和什么版本是固定的。谢谢!

您也可以坚持使用0.9.8.33,直到修复完成-我们甚至有一种方法可以安装老客户端- https://github.com/chocolatey/chocolatey.org/issues/162

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/30515822

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档