How to search ALL variables, and scripts, for a string

How could I search ALL variables, both Variable Sets AND Project Variables, for the occurrence of a string. In our case it’s for searching for a certain Sql Server connection string that needs to be modified due to a server migration.

Additionally I need to search all our (PowerShell) scripts, also for the same string.

This seems to me a common use case.

Hey @optinicolas,

Thanks for reaching out to Octopus support and welcome to the community! From what you’ve described, this script from our public API repo might be what you’re looking for. There are several other scripts in that repo that you might find helpful and they can be modified to suit your needs.

Please let us know if you have any other questions.

Best,
Brent

1 Like

Hi Brent,

That really helps! At least for searching variables, but I don’t find any script there that will help me search through all our Powershell script templates. Or am I missing something?

Regards,
Nick

Hey @optinicolas,

Unfortunately, that script will only search through variable values. We don’t currently have a script that can search through templates, as our standard practice is to use variable values in step templates. You might be able to modify that variable script or one of our other scripts to search templates for a string value.

Best,
Brent

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.