Update-ExecutionPolicy errors

Dec 14, 2013 at 1:08 AM

I am trying to run through some of your simple scripts. I have the following package deployed to my local nuget server as dev-browsers.
Update-ExecutionPolicy Unrestricted

Write-Host 'Installing browsers...'
cinst GoogleChrome
cinst Firefox
cinst ie
Chocolatey is able to download the package and begin to install the package. Unfortunately, it reports the following error:
Write-Error : Package 'dev-browsers v1.0.0' did not install successfully: The term 'Update-ExecutionPolicy' 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 C:\Chocolatey\chocolateyinstall\functions\Chocolatey-NuGet.ps1:90 char:28
+                 Write-Error <<<<  "Package `'$installedPackageName v$installedPackageVersion`' did not install successfully: $($_.Exception.Message)"
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Write-Error

Finished installing 'dev-browsers' and dependencies - if errors not shown in console, none detected. Check log for errors if unsure.
I was under the impression that the BoxStarter commands were accessible by the script, but perhaps I missed something. I do have BoxStarter installed on the system and I can run Update-ExecutionPolicy Unrestricted from the command line.

Am I doing something wrong?

Dec 14, 2013 at 1:35 AM
Hi Kevin,

Can you tell me how you are invoking the dev-browsers package? Are you using one of the boxstarter commands like
Install-BoxstarterPackage dev-browsers
If you try to install it with just cinst, it will not work.

Also, what OS are you on?

Dec 14, 2013 at 2:06 AM
I am installing on Windows 7. I was trying to run with cinst.
cinst dev-browsers -source http://myLocalServer:81/nuget/Chocolatey
It was unclear to me from the documentation that this would not work. Could you explain why?

It appears that it is working when I run with the following commands
Set-BoxstarterConfig -NugetSources "http://myLocalServer:81/nuget/Chocolatey"
Install-BoxstarterPackage dev-browsers
What I am trying to do here is create packages that group related installations (i.e., system tools, browsers, editors, etc.) and then use a master script that will call those based upon the role of the node (e.g., developer's work environment, developer's test environment, staging environment, etc.). What would you recommend I call for those master scripts, because I was envisioning something that looked like this
cinst system-tools
cinst dev-browsers
cinst dev-editors
However, based on what I just learned I do not believe this will work.
Dec 14, 2013 at 5:32 AM
Sorry for not being more explicit on that point in the docs. Were you looking at the Boxstarter.org docs or just the codeplex docs? The Boxstarter.org docs are much more complete. If you have not already checked out http://boxstarter.org/InstallingPackages, you may find that helpful. The reason cinst will not work on its own is that it creates a separate Powershell session that will not have the Boxstarter modules loaded. Also, there are several environment elements that Boxstarter adds for reboot resiliency, to prevent other installers from interfering with the chocolatey installs as well as some other details necessary when running remotely.

There are several ways to accomplish what you want to do. Looks like you are trying to create several fine-grained packages that can be composed in different combinations depending on the environment. That works well. What you can do is create a "Master" script for each type of environment. For example, maybe your dev environment might be driven by a package called DevBox and its ChocolateyInstall looks exactly like what you have above. DevBox would need to be called by Install-BoxstarterPackage or one of the other boxstarter invokers mentioned in http://boxstarter.org/InstallingPackages but the "inner" composable packages can be called by cinst.

Does that make sense?
Dec 14, 2013 at 4:01 PM
Yes, thank you for the clarification.

btw-- I was looking at both locations for the documentation. I was looking here for creating packages. I simply missed this statement:
Once you are finished composing your package contents, you can call the Invoke-BoxstarterBuild MyPackage command to generate the *.nupkg file for MyPackage. Boxstarter saves these files in the root of $Boxstarter.LocalRepo. If you have several packages in the local repository that you want to build all at once, omit the package name from the command to build all packages in the repository.