2016-06-07 4 views
3

IIS을 설치하려고 Octopus deploy를 사용하여 대상 컴퓨터에서 PowerShell 스크립트를 실행하고 있습니다. 아래 스크립트를 사용하고 필요한 매개 변수를 전달합니다. 어떤 차종이 전화가 제대로 이루어지고 있다고 생각 될 기록됩니다, 그러나 그것은 단순히 응답 :Chocolatey가 창을 찾을 수 없습니다.

Chocolatey 패키지 저장소에서 패키지 IIS-WebServerRole 설치

...

17:11:48Info 
Installing the following packages: 
17:11:48Info 
IIS-WebServerRole 
17:11:48Info 
By installing you accept licenses for the packages. 
17:11:48Info 
IIS-WebServerRole not installed. The package was not found with the source(s) listed. 
17:11:48Info 
If you specified a particular version and are receiving this message, it is possible that the package name exists but the version does not. 
17:11:48Info 
Version: "" 
17:11:48Info 
Source(s): "windowsFeatures" 

코드 :

$chocolateyBin = [Environment]::GetEnvironmentVariable("ChocolateyInstall", "Machine") + "\bin" 
if(-not (Test-Path $chocolateyBin)) { 
    Write-Output "Environment variable 'ChocolateyInstall' was not found in the system variables. Attempting to find it in the user variables..." 
    $chocolateyBin = [Environment]::GetEnvironmentVariable("ChocolateyInstall", "User") + "\bin" 
} 

$cinst = "$chocolateyBin\cinst.exe" 
$choco = "$chocolateyBin\choco.exe" 

if (-not (Test-Path $cinst) -or -not (Test-Path $choco)) { 
    throw "Chocolatey was not found at $chocolateyBin." 
} 

if (-not $ChocolateyPackageId) { 
    throw "Please specify the ID of an application package to install." 
} 

$chocoVersion = & $choco --version 
Write-Output "Running Chocolatey version $chocoVersion" 

$chocoArgs = @() 
if([System.Version]::Parse($chocoVersion) -ge [System.Version]::Parse("0.9.8.33")) { 
    Write-Output "Adding --confirm to arguments passed to Chocolatey" 
    $chocoArgs += @("-y", "") 
} 

if($ChocolateyPackageSource) { 
    Write-Output "Adding --source to arguments passed to Chocolatey" 
    $chocoArgs += @("-source", $ChocolateyPackageSource) 
} 

if (-not $ChocolateyPackageVersion) { 
    Write-Output "Installing package $ChocolateyPackageId from the Chocolatey package repository..." 
    & $cinst $ChocolateyPackageId $($chocoArgs) 
} else { 
    Write-Output "Installing package $ChocolateyPackageId version $ChocolateyPackageVersion from the Chocolatey package repository..." 
    & $cinst $ChocolateyPackageId -version $ChocolateyPackageVersion $($chocoArgs) 
} 

내가 찾을 수있는 가장 최근의 Chocolatey 문서를 기반으로하면 이것이 효과가있다. 왜 그런 생각을 못하니? Azure Windows 2012 R2 VM에 대해 언급해야합니다.

+0

촉수가 실행되는 사용자로 수동 실행되는 상자에서 powershell 스크립트를 실행할 수 있습니까? –

+0

@AlexM - 예. 관리자로 컴퓨터에 로그온해도 똑같은 메시지가 표시됩니다. 창 기능이 작동하지 않는 것 같습니다. 나는 심지어 작동하지 않는 호출의 일부 오래된 버전을 시도했다. 나는 Chocoly를 사용하는 것에 익숙하다. 그래서 내가 분명히 잘못된 것을하고 있다고 생각했다. – swannee

답변

2

저는 초콜릿이 시험판 버전으로 출시되어이 기능을 사용할 수있었습니다. 9.10.x-beta ...

나는 단지 -pre를 사용하는 것이 패키지를 설치하기에 충분하지 않다는 것을 알아야한다. 왜냐하면 어떤 이유로 패키지를 업데이트하여 패키지를 업데이트해야한다. 그 자체. 이것이 의도적인지 확실하지 않습니다.

+0

확실히 의도적으로 설계된 것이 아닙니다. 로그가 작동하지 않는다면 한번보세요. 사이드 노트,'choco upgrade chocolatey -pre'는'choco install chocolatey -pre' /'cinst chocolatey -pre'가 아닙니다. 두 번째 두 명령은 설치가 무언가를 설치하고 업그레이드가 그때부터이기 때문에'--force'를 요구합니다. HTH. 그것이 다른 것이라면 알려주세요. – ferventcoder

+0

나는 내가 업그레이드를하고 있다고 확인했다. 왜 강제력이 필요한지 잘 모르겠다. 다시 해보면 몇 가지 로그를 보내 게 될 것이다. – swannee

+0

쿨 - 로그는 디버그/상세 형식으로 저장됩니다. 그래서 당신이보고 싶을 때 도움이됩니다. – ferventcoder