chocolatey/chocolatey — Issue #59: Can't install on Server Core 2008 R2
Author: Iristyle
Created: 2012-01-28 02:07:55+00:00
State: open

The COM Shell.Application instance apparently doesn't have the code necessary to unzip on Core. Unfortunately I don't think there's an easy way around this one, other than to download some sort of unzip application first like 7-zip, unzip, etc.

Here's a solution for this that I use, but... it's probably not something you'd want to do.

Import-Module BitsTransfer
$Is32Bit = (($Env:PROCESSOR_ARCHITECTURE -eq 'x86') -and ($Env:PROCESSOR_ARCHITEW6432 -eq $null))

#7zip
$7zUri = if ($Is32Bit) { 'http://sourceforge.net/projects/sevenzip/files/7-Zip/9.22/7z922.msi/download' } `
else { 'http://sourceforge.net/projects/sevenzip/files/7-Zip/9.22/7z922-x64.msi/download' }

Start-BitsTransfer $7zUri 7z922.msi
Start-Process -FilePath "msiexec.exe" -ArgumentList '/i 7z922.msi /norestart /q INSTALLDIR="c:\program files\7-zip"' -Wait
SetX Path "${Env:Path};C:\Program Files\7-zip" /m
$Env:Path += ';C:\Program Files\7-Zip'
del 7z922.msi

Here's the error output during the install:

PS C:\Users\Administrator> Invoke-Expression ((new-object net.webclient).DownloadString('http://bit.ly/psChocInstall'))

Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 1/28/2012 1:17 AM chocInstall
Downloading http://chocolatey.org/api/v1/package/chocolatey to C:\Users\ADMINI~1\AppData\Local\Temp\2\chocolatey\chocInstall\chocolatey.zip
Extracting C:\Users\ADMINI~1\AppData\Local\Temp\2\chocolatey\chocInstall\chocolatey.zip to ...
Exception calling "NameSpace" with "1" argument(s): "Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))"
At line:35 char:42
+ $zipPackage = $shellApplication.NameSpace <<<< ($file)
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ComMethodTargetInvocation

You cannot call a method on a null-valued expression.
At line:37 char:46
+ $destinationFolder.CopyHere($zipPackage.Items <<<< (),0x10)
+ CategoryInfo : InvalidOperation: (Items:String) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull

Installing chocolatey on this machine
The term 'C:\Users\ADMINI~1\AppData\Local\Temp\2\chocolatey\chocInstall\tools\chocolateyInstall.ps1' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:44 char:2
+ & <<<< $chocInstallPS1
+ CategoryInfo : ObjectNotFound: (C:\Users\ADMINI...ateyInstall.ps1:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

Ensuring chocolatey commands are on the path
Updating chocolatey to the latest version
The term 'cup' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:60 char:4
+ cup <<<< chocolatey
+ CategoryInfo : ObjectNotFound: (cup:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException