Thanks for reaching out. You’ll either need to filter the values from $OctopusParameters as shown on the script below, or include prefixes on your variables (which I agree would be very annoying). I think you can get there with some smart filtering on the where-object side of the pipeline
$variables = $OctopusParameters.getenumerator() | where-object {$_.key -notlike "Octopus.*" -and $_.key -notlike "env:*"}
foreach($variable in $variables)
{
# Perform the desired action here e.g.
Write-Output $variable
}