For the complete documentation index, see llms.txt. This page is also available as Markdown.

Scripting for DeployR Server

Using the PowerShell Module to automate tasks or do lookups.

Authenicating to DeployR Server for Scripting

Depending on how you have configured security for your DeployR server, you might need to leverage the Connect-DeployR function to be able to authenticate before running commands. In my example, I'll be leveraging the passcode method of autentication.

Import-Module 'C:\Program Files\2Pint Software\DeployR\Client\PSModules\DeployR.Utility'
Connect-DeployR -Passcode PASSWORD

Once you've authenticated, you'll be able to retrieve information and content using PowerShell. One of the primary reasons for this would be to do backups of your items, for disaster recovery, or for importing into another DeployR instance, like prompting from test to prod.

You can create extensive backup scripts, filtering for specific items, or generic to backup everything. Getting data and exporting can be done with a couple of functions.

Exporting Content Items

Get-DeployRContentItem, when used without parameters, will pull back all content items, which you can then pipe into Export-DeployRContentItem

Get-DeployRContentItem | Export-DeployRContentItem -DestinationFolder "D:\Backups\Temp\"

Here is a sample code block where we filter out built in packages (-notlike '0000000-*'), and filter on purpose of "Other".

Exporting Step Definitions

If you're creating step definitions for your organization, these too would be a great thing to backup. To get the step definition data, you'll use the Get-DeployRMetaData function with the -Type StepDefinition parameter. You can then Export that with the Export-DeployRStepDefinition function

Here is a sample code block used to backup all Step definitions that aren't built in by default (-notlike '0000*')

Exporting Task Sequences

To export a task sequence, use Get-DeployRMetaData with the -Type TaskSequence parameter, then pipe that to Export-DeployRTaskSequence or run the Export-DeployRTaskSequence function with the Id parameter.

Example below of taking the ID which can be found via PowerShell or the URL for the task sequence in the dashboard.

Here is a sample code block for exporting task sequences that are not built in

The exported task sequence will be a json file with the name of the GUID. It will not include the content items referenced, just the metadata of the task sequence.

For a script example, check out this on our GitHub: https://github.com/2pintsoftware/2Pint-DeployR/blob/main/Samples/Webinars/ExportSpecificTaskSequenceMetaData.ps1

Importing Task Sequences

Importing requires you have access to an exported task sequence json file, then running the import function like so:

Clone Task Sequence

The clone feature is identical to the importing, but you specify -clone

For an example script of the clone ability, see this script on our GitHub. https://github.com/2pintsoftware/2Pint-DeployR/blob/main/Samples/Webinars/CloningTaskSequenceDemo.ps1