login vsi company logo login vsi company logo 250x40


Get the best possible VDI performance, density and availability with Login VSI
Our Solutions

  • Home
  • Blog
  • Login PI
  • How To: Login PI bulk administration through RESTfull API and Powershell

How To: Login PI bulk administration through RESTfull API and Powershell

Login PI

For a large Login PI deployment a method was needed to change the workload on all profiles. The Login PI RESTfull API (API) easily enables this. To get started create a Powershell script. For this blogpost the Windows Powershell ISE was used.

Code capture 1 Login PI



Create the variables that will be reused. In this case the PI base URL. This script will be ran directly on the PI server. This script assumes PI is installed on the default port 8080. These values will need to be changed if the PI server is configured for SSL. See https://loginvsi.zendesk.com/hc/en-us/articles/115004469265-Login-PI-Configure-Management-Console-for-SSL.

The second variable is the workload that the script will set on every profile. In this case one of the default workloads.

Code capture 2



Next the script will collect all the available profiles on the PI server. The script first defines where those profiles will be retrieved. The PI base URL was defined earlier. The profilesapi/profiles path was retrieved using a method that will be described in a future blog post.

Using the profiles API URL the script will retrieve all available profiles using the invoke-restmethod command. Note that UseDefaultCredentials is specified. Login PI uses authenticated API endpoints. This parameter specifies that the credentials of the user running the Powershell script should be passed to the API endpoint for authentication. This assumes that the user account running the script is a Login PI administrator. The profiles are stored in a variable for later use.

Code capture 3



Once all the available profiles are collected the script will iterate through the profiles. Using a so called for each loop each available profile in the collection of profiles is put in a variable so that each profile can be operated on separately.

Code capture 4

Inside the for each loop the ID of the profile is stored in a separate variable. Next the API URL used for setting the workload is defined. This URL is made up out of the PI base URL, the profile ID for the profile currently being processed by the for each loop and the URL path components for the API endpoint.

Login PI uses JSON as the syntax to define data. Powershell can convert a hashtable to a JSON object. So the script defines a hashtable with the appropriate names for the different fields expected by the workloadsettings API endpoint. Note the office language, operating system language and office version are hardcoded. These IDs can be determined by looking at the list of these values in the PI dashboard.

Code capture 5

Please note that your values can differ but are likely the same.

Once the JSON data is properly formatted by the ConvertTo-JSON command the API URL is called using Invoke-RestMethod using the UseDefaultCredentials parameter discussed earlier. The Invoke-RestMethod command is also configured to use content type JSON. This lets the API endpoint know that the data is in the JSON format/syntax. Last but not least the HTTP method PUT is used. The JSON data is attached in the body of the request.

Code capture 6

Finally the script will ask the PI server to parse the new workload. Using the same principles discussed earlier. A request URL is created out of the PI base URL, profile ID and API endpoint URL components. The resulting URL is then invoked using the POST method. No body is attached as the parseworkload API endpoint doesn’t require a body. It simply uses the profile ID that is part of the request URL to understand which workload to parse. Last but not least the script outputs on which profile the workload has been changed.

A future blogpost will describe how to enhance this script to allow a CSV file to potentially specify a different workload per profile.

Please note that much of the structure of this script was originally written by Henk Hofs. I merely adapted it to fit my needs.

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


Our industry-standard software is built to help you avoid problems, lower costs and improve performance. Request a Quote or get your (free!) Trial below, and benefit from our award-winning services:

Request Quote Request Trial



About the author

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. 

Tags: How-to, Login PI

Popular Blogs

Login VSI Blog Article - Microsoft Windows 10 Default FTA Associations - Teaser Image

Windows 10 Default File Type Associations and Login VSI

When Login VSI 4.1 was released, the majority of desktops were running Windows 7 and life was easy. We’d set the default filetype for an application and it would simply work. Continue Reading
Login VSI - Press Release - IGEL - Login VSI Partner to Optimize End User Computing Experience Image

[Press Release] IGEL Partners with Login VSI to Optimize the End User Computing Experience

Login PI enables organizations to better protect the performance and availability of their IGEL OS-powered virtual desktop environments Continue Reading
Login VSI - Blog - Login PI Blog Teaser Image - Windows Virtual Desktop: How To Monitor User Experience With Login PI

Windows Virtual Desktop – How to Monitor User Experience?

Microsoft has just announced the public preview of their new Windows Virtual Desktop (WVD) offering at Microsoft Ignite on Tour in Amsterdam today. For those of you who’ve not followed the rumors or the private beta, here’s the outline... Continue Reading
Login VSI Blog - Teaser Image - A Practical Guide to VDI Change Management - Part 1

A Practical Guide to VDI Change Management

Part 1: IT Change Management in general The first in an 8-part series, this practical guide to VDI Change Management will guide you through the transformation of the IT department from a back-end function into a core competency for every modern organization. Continue Reading
Investigating Online Application Performance with Login PI

Investigating Online Application Performance with Login PI

As many companies do, we use a CRM system. Recently, I have been getting complaints about our cloud CRM system, Microsoft Dynamics, being slow. I tried to investigate this by shadowing one of our users to see what was wrong. Continue Reading
Login VSI -Blog Post - IGEL Partner with Login VSI

Login PI & IGEL: Delivering Deep Application Test & Availability Monitoring

Together Login VSI and IGEL deliver deep application test and availability monitoring for the digital workspace This week we announced a partnership with IGEL that enables Login PI integration in a radical new way. Continue Reading
Cookie Settings