Setting Octopusvariables from powershell script

In my setup I have a config file in json that specifies everything I need for IIS, like app pool, site, application and such. To avoid having to specify this in two places I would like to have my PreDeploy reading the config and set the OctopusWebsiteName variable based on the values in the config file, so that the OctopusWebsiteName is used later in the deployment process. This way I could just point to different config files for the different environments and the config files could be put under source control.

Hi Thomas,

If PreDeploy.ps1 allowed you to write something like this:

Set-OctopusVariable -name "OctopusWebsiteName" -value "my value"

Would this solve the problem?

Paul

I most definitely will. I think that would be an awesome improvement enabling user to version control their octopus variables.

Would that also work for variables that I have defined in Octopus? I’m not sure it is as useful as for Octopus specific variables since your own defined ones you should be able to control anyway.

Is this implemented yet? :stuck_out_tongue:

I think it is, https://trello.com/card/ability-to-set-variables-via-powershell-scripts/4e907de70880ba000079b75c/246.

Yes it works thanks!