How to dynamically use provisioning templates based on a custom inventory value

Modified on Thu, 11 May 2023 at 03:56 PM

For some customers it is important to use a special provisioning template based on a computer attribute. This might be the host name or in this case a "Custom Inventory" value.

The customizable console process allows you to achieve this easily.
For this example let's assume the customer is having a custom inventory field called "Line of Business". For some "Line of Business" it is required to use a special provisioning template.

Step 1 - adjusting the process config file

Edit the file C:\inetpub\wwwroot\five9sWS\ConsoleProcess\configs\P03Osd.json

Change process step 090:

  • Action: Add
  • Executable: OSDTemplate.ps1
  • ParameterList: -attribute \"[CI:Line of Business]\"


{
      "Name": "Step090",
      "Action": "Add",
      "Description": "Gets the Provisioning Template. Custom.exe call can overwrite the TemplateId (int) if is valid in the StandardOutput.",
      "ProcessFailOnError": true,
      "Executable": "OSDTemplate.ps1",
      "ParameterList": "-attribute \"[CI:Line of Business]\""
},

Step 2 - create a Powershell script

Now we create a PowerShell script, which will check the passed "Line of Business" attribute and returns different provisioning template IDs to the operating system deployment process.

Create the file OSDTemplate.ps1 in the folder "C:\inetpub\wwwroot\five9sWS\ConsoleProcess\configs\"


Important Notice:
For security reasons it is only possible to invork PowerShell scripts in this folder or subfolder.
param([string]$attribute)

$validLobsAB = ("Line of Business A", "Line of Business B")
$validLobsXZ = ("Line of Business X", "Line of Business Z")

if ($validLobsAB.Contains($attribute))
{
    Write-Output "{""TemplateId"":""8""}"
} 

if ($validLobsXZ.Contains($attribute))
{
    Write-Output "{""TemplateId"":""12""}"
} 
The sample code above checks, if the selected "Line of Business" is A or B, and returns provisioning template ID 8 and for "Line of Business" X and Z it returns the provisioning template ID 12.
For all other cases the provisioning template ID of the selected operating system will be used.


Tipp:
If you do not know the ID of your provisioning template, go to the Ivanti Management Console and check the column "Template ID" in the operating system provisioning overview.
Now you are ready to use provisioning templates dynamically.
Last Modified Date
04.05.2023

Verified versions
five(9)s Console version 4.2.73 and above

Tags
  • Operating System Deployment
  • Custom Inventory
  • Provisioning Templates

Disclaimer
Even though every care has been taken by five(9)s GmbH to ensure that the information contained in this publication is correct and complete, it is possible that this is not the case. five(9)s GmbH provides the publication "as is", without any warranty for its soundness, suitability for a different purpose or otherwise. five(9)s GmbH is not liable for any damage which has occurred or may occur as a result of or in any respect related to the use of this publication. five(9)s GmbH may change or terminate this publication at any time without further notice and shall not be responsible for any consequence(s) arising there from. Subject to this disclaimer, five(9)s GmbH is not responsible for any contributions by third parties to this publication.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article