Thanks for getting in touch!
This is a basic script that will run a specific runbook and runbook snapshot with the ability to specify the desired environment and tenant. It is very barebones and requires the specific IDs for each resource, this could be enhanced by adding in some lookups on the names to retrieve the required IDs.
Add-Type -Path 'Octopus.Client.dll'
$apikey = 'API-xxxxx' # Get this from your profile
$octopusURI = 'http://xxxxx' # Your Octopus Server address
$runbookId = "Runbooks-1" # Get this from /api/runbooks
$runbookSnapshotId = "RunbookSnapshots-1" # Get this from /api/runbookSnapshots
$environmentId = "Environments-1" # Get this from /api/environments
$tenantId = "Tenant-1" # Get this from /api/tenants
$endpoint = New-Object Octopus.Client.OctopusServerEndpoint $octopusURI,$apikey
$repository = New-Object Octopus.Client.OctopusRepository $endpoint
$runbook = $repository.RunbookSnapshots.Get($runbookSnapshotId)
$deployment = New-Object Octopus.Client.Model.RunbookRunResource
$deployment.RunbookId = $runbookId
$deployment.RunbookSnapshotId = $runbookSnapshotId
$deployment.EnvironmentId = $environmentId
$deployment.TenantId = $tenantId