I have a powershell script where I want to get the name and Id of the RunBook, but they return empty. It seems that they are not mapped to the powershell parameters list. We are running version 2019.11.1.
To get these, I used step template with the below script:
write-host "Octopus.Runbook.Name= " $OctopusParameters["Octopus.Runbook.Name"]
write-host "Octopus.RunbookRun.Comments= " $OctopusParameters["Octopus.RunbookRun.Comments"]
write-host "Octopus.RunbookRun.Created= " $OctopusParameters["Octopus.RunbookRun.Created"]
write-host "Octopus.RunbookRun.CreatedUtc= " $OctopusParameters["Octopus.RunbookRun.CreatedUtc"]
write-host "Octopus.RunbookRun.ForcePackageDownload= " $OctopusParameters["Octopus.RunbookRun.ForcePackageDownload"]
write-host "Octopus.RunbookRun.Id= " $OctopusParameters["Octopus.RunbookRun.Id"]
write-host "Octopus.RunbookRun.Name= " $OctopusParameters["Octopus.RunbookRun.Name"]
write-host "Octopus.RunbookRun.PreviousSuccessful.Id= " $OctopusParameters["Octopus.RunbookRun.PreviousSuccessful.Id"]
write-host "Octopus.RunbookSnapshot.CurrentForEnvironment.Id= " $OctopusParameters["Octopus.RunbookSnapshot.CurrentForEnvironment.Id"]
write-host "Octopus.RunbookSnapshot.CurrentForEnvironment.Name= " $OctopusParameters["Octopus.RunbookSnapshot.CurrentForEnvironment.Name"]
write-host "Octopus.RunbookSnapshot.Id= " $OctopusParameters["Octopus.RunbookSnapshot.Id"]
write-host "Octopus.RunbookSnapshot.Notes= " $OctopusParameters["Octopus.RunbookSnapshot.Notes"]
write-host "Octopus.RunbookSnapshot.Previous.Id= " $OctopusParameters["Octopus.RunbookSnapshot.Previous.Id"]
write-host "Octopus.RunbookSnapshot.Previous.Name= " $OctopusParameters["Octopus.RunbookSnapshot.Previous.Name"]
write-host "Octopus.RunbookSnapshot.PreviousForEnvironment.Id= " $OctopusParameters["Octopus.RunbookSnapshot.PreviousForEnvironment.Id"]
write-host "Octopus.RunbookSnapshot.PreviousForEnvironment.Name= " $OctopusParameters["Octopus.RunbookSnapshot.PreviousForEnvironment.Name"]
write-host "Octopus.Web.RunbookRunLink= " $OctopusParameters["Octopus.Web.RunbookRunLink"]
write-host "Octopus.Web.RunbookSnapshotLink= " $OctopusParameters["Octopus.Web.RunbookSnapshotLink"]