Retrieve the list of steps for that Deployment

I am trying to create a Step Template that can access each step’s Status.Code, so the step can produce error specific notification to our company message board. Is there a way retrieve the list of steps in Powershell and loop through each step to retrieve the Status.Code

I have tried $steps = $OctopusParameters["Octopus.Step"], but $steps is always empty