Invoke Draft Snapshot from powershell script

Hi Team,
when we invoke an runbook snapshot sometimes the latest changes are missed [variables updates] and we would like to know if we can use the draft snapshot/current changes so that the runbook will always consider the latest changes available including the variables changes. Or will publishing the runbook to create an latest snapshot and use them is the only solution ?

Thanks,
Sujesh Sasidharan

Hi Sujesh,

Thank you for getting in touch! Great question, though the default behavior is generally that running a runbook without specifying a snapshot will default to running the published snapshot. Updating the variables in the project won’t automatically generate a new snapshot with those changes reflected within, so we’d need a way to create a draft snapshot via PowerShell while keeping it unpublished.

I don’t have a specific sample script to do only this, however the following script creates a snapshot and then publishes it so you could potentially cherrypick from it to create the snapshot, leaving out the publishing.

Hopefully that helps! Let me know what you think, or if I’ve misinterpreted what you’re after in any way. :slight_smile:

Best regards,

Kenny

Hi Kenny,
Thanks for the update. I am able to create an snapshot of the runbook and use the latest snapshot to trigger it. Does the creation of an snapshot of an runbook makes sure all the variables including the Project Variables/Library set variables are updated as part of the specific snapshot ?

Thanks,
Sujesh Sasidharan

Hey @sujeshsasi,

Just jumping in for Kenny who is currently off shift as part of our Australian based team.

Creating a new runbook snapshot will include all the updated variables from the project yes, you can find more information about runbook snapshots here if you have not seen it yet.

One thing I will mention from that document is:

Draft snapshots can’t be used to create a scheduled runbook trigger, only published snapshots can.

So to get your updated library variables to be included in the runbook run you do need to publish the latest snapshot of that runbook.

That document will tell you all you need to know about draft and published snapshots, if you have any follow up questions let me know and I will be happy to answer them for you.

Kind Regards,
Clare

Thanks Clare. this helps. I do not have any further questions.

Hey @sujeshsasi,

No problem helping customers is what we are here for,

Reach out in future if you need any assistance as we are always on hand to help!

Kind Regards and Happy Deployments,
Clare

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