Generate Application Content Items

Using PowerShell can be a nice way to automate the generate of Application content items and save a bit of time vs using the dashboard. There are a few steps in creating content items with PowerShell, first making the "Shell" Content Item, then the version item inside of it. Just a note, this is different than importing one you exported from another DeployR server, this is creating a completely new content item from scratch in an automated fashion.

You'll be leveraging a few different DeployR Functions

  • Get-DeployRApplication

  • New-DeployRContentItem

  • New-DeployRContentItemVersion

In this Example, we'll be creating the 7zip Application Content Item. I've downloaded the 7zip MSI to my sources folder and I have my installation command line, I'll plug them in as variables. First we'll create the Content Item Shell, once completed, we'll see this in the Dashboard.

circle-info

Note, anytime we're using the DeployR functions and interacting with DeployR, you'll need to import and connect to DeployR, you can find this on the Scripting for DeployR Server page

$AppName = '7zip'
$NewDRCI = New-DeployRContentItem -Type Folder -Name $AppName -Description "Script Generated" -Purpose Application

Once the Content Item shell is created, we'll populate the version with the details:

$AppSourceFolder = 'D:\DeployRSources\Applications\7-Zip\26.00'
$AppDescription = '26.00'
$InstallationCommandLine = 'msiexec.exe /i "7z2600-x64.msi" /quiet /norestart'
New-DeployRContentItemVersion -ContentItemId $NewDRCI.id -SourceFolder $AppSourceFolder -InstallationCommandLine $InstallationCommandLine -Description $AppDescription

Overall, it's pretty straight forward to create an Application Content Item in DeployR. Once you know the basics, you can start to get more fancy, I've created several functions to simplify automation of generating these applications. These functions are:

  • New-DeployRApp

    • This is used for creating a brand new app

  • Test-DeployRAppExists

    • Used for automation when automating generating apps to determine if you're trying to generate one that is already there.

  • Update-DeployRApp

    • Used to update an App already in DeployR by appending a new Version

With these functions, I've automated creating and updating several applications automatically in my DeployR Lab. The full script is on our GitHub, https://github.com/2pintsoftware/2Pint-DeployR/blob/main/Automation/Generate-AppContentItems.ps1arrow-up-right

Last updated