How to: Login PI bulk administration – changing a profile’s workload using a CSV file - Login VSI
  • Variant A
  • Variant A
  • login vsi company logo 250x40
    • Home
    • Login VSI Blog
    • How to: Login PI bulk administration – changing a profile’s workload using a CSV file

    How to: Login PI bulk administration – changing a profile’s workload using a CSV file

    The previous blog post explained the basics around using the Login PI RESTful API through Powershell. This blog post will build on that foundation to change the workload assigned to profiles based on a CSV file instead of assigning the same workload to each server.

    The use case for this script is a large-scale Login PI customer that needs to change the workload assigned to profiles regularly. Since the PI interface is intended for small-scale changes the API is used. As the API allows large bulk operations with ease.

    The first step is to define the variables that will be reused. This will be the same variable used in the previous blog post. The PIbaseURL points to the location where the PI backend is hosted. In this example, the default port of 8080 is used.


    Next the script will retrieve all the available profiles. The profiles are stored in a variable for later reference.


    Now that the profiles are retrieved the CSV file needs to be read. Powershell has built-in mechanisms to deal with CSV files. Making it very easy to deal with CSV files. Please note that for this example the CSV file used has a very specific structure. The first row is the title for the column.

    CSV file

    By giving the column a title Powershell can refer to the row by using an object property after loading the CSV file.


    This tells Powershell to load a CSV file from the indicated path and store the content in a variable.

    CSV file import

    After the import the contents of the CSV file can be referenced to by using object properties.

    The script will then iterate through the CSV file based on the server name specified. In this use case the customer had a profile for every server they wanted to directly connect to. The use case allows the script to identify the profile based on the server that is being connected to. As the name of the profile will match the server name. Your profile names may be different. Just be aware that this script will assign the workload based on the name of the profile.


    This line tells Powershell that the script wants to do something with every line of the CSV file based on the server column.

    At the point the script will retrieve the id assigned to the profile based on the name of the profile as stored in the CSV file. The script will also assign the workload name from the CSV file to the serverWorkload variable. That will allow the rest of the script to be copy/pasted from the previous script.


    The rest of the script is the same as the script from the previous blog post. Except for the workload not being hardcoded but taken from the CSV file


    With the basics behind the Login PI RESTful API and taking information from a CSV file covered the next installment in this series will cover finding the API endpoints to automate pretty much anything in the Login PI configuration.

    Do you have a use case for Login PI that may seem out of the range of the capabilities for Login PI? The Login VSI Professional Services team has completed thousands of custom fit solutions for challenging use cases. Feel free to reach out to us at with your questions and how we can provide a solution that will improve your overall end user experience.

    Disclaimer: many of the API endpoints mentioned in this blog post are not supported. Meaning they may change from release to release. This blog post is therefore provided AS-IS.

    About the author
    Dennis Geerlings

    Dennis Geerlings started at Login VSI about 4 years ago and worked as a consultant within Login Consultants. He supported multiple customers in migration projects. Presently, Dennis is support manager and lead consultant at Login VSI. In these roles he supports customers and partners in the US and Canada, co-develops the Login VSI product, and serves as a pre-sales engineer for enterprise customers.