Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.

If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!

Questions relating to Powershell and chocolatey



  • We are evaluating Pro-Get and Otter, i've created a chocolatey repository on the pro-get server, and from the command line installs "choco install chocolatey" work great.

    the next stage was to provide some automation to the task, so i've been testing this out this afternoon. So my test role looks like this (local server)

    ##AH:UseTextMode
    # Ensure Choco
    # Checks the chocolatey environment is installed
    {
        Ensure-File C:\ProgramData\chocolatey\bin\choco.exe;
    }
    
    # Install Packages
    # Install Chocolatey Packages
    {
        PSExec choco install googlechrome -y --force;
    }
    

    Google chrome however isn't installing and i think it's a permissions error looking at the chocolatey log file

    • Privileges: is psexec running as system on the local machine, i need to ensure this is running as Admin
    • Do you have any examples of installing packages from a Pro-get server using Otter?
    • Am I doing this right?

    Essentially i'd like to automate the installing of the Pro-Get Choco repository onto all Windows 10 Machines in a specific environment.



  • Hi David,

    A couple notes...

    • Ensure-File is really about ensuring that a file you define in the plan exists, like a configuration or text file of sorts; if choco.exe isn't there, then the operation will create it; alternatively, you may want to just test for the file using powershell (PSExec) and raise an error if it's not there

    • We would definitely love to have/build a chocolatey extension for Otter that ensures chocolatey packages :)

      • Chocolatey::Ensure-Installed
      • Chocolatey::Ensure-Package
      • ... stay tuned!
    • PSExec will run under whatever credentials the service/agent is running under, so if you need to do admin things, then make sure to have the service running as local system.

    • You may want to look at the stand-alone romp tool for running plans on workstations



  • thanks for the reply,

    PSExec will run under whatever credentials the service/agent is running under, so if you need to do admin things, then make sure to have the service running as local system

    While that is true, what i've confirmed is, even if i force in a -h, the PSEXEC while running as local admin, won't run with elevated privilages (just as clicking in powershell isn't the same as right clicking and choosing run as administrator while your a local admin) So i can't run what I need as an elevated environment is needed to install the chocolatey software.



  • Hmm, I wonder if it's related to Powershell Execution Policy? I'm not terribly familiar myself, but I know I've had to fiddle with that a bit to get things working...

    15 Ways to Bypass the PowerShell Execution Policy



Inedo Website HomeSupport HomeCode of ConductForums GuideDocumentation