How to use Powershell with the Workspace ONE UEM API to search for users

Using API's has been infinitely helpful in integrating Workspace ONE UEM with other enterprise services and applications. A question was asked recently about forming the correct HTTP header using Powershell, and returning the users in the users. Below is an example Powershell script I was able to create for this example. Make sure to include base64 encoded credentials in a folder (c:\creds\b64.txt in the example), and to update the $apiKey variable with an API key.

#Workspace ONE UEM Environment Address / Authentication 
$addy = ""
$b64 = Get-Content -Path "c:\creds\b64.txt"
$apiKey = "apikey"
$b64EncodedAuth = "$b64"

$content = "application/json" 
$authHeader = "Basic " + $b64EncodedAuth
$header = @{"Authorization" = $authHeader"aw-tenant-code" = $apiKey"Accept" = $content"Content-Type" = $content}

#Get Users from Workspace ONE API
$getUsers = Invoke-RestMethod -Uri "$addy/API/system/users/search" -Headers $header


When reviewing the results from the object with $getUsers.Users, the following is stored in the variable:

Ryan Pringnitz


Popular posts from this blog

How to use Fiddler Everywhere to inspect Android network traffic to troubleshoot SAML authentication issues

Clean up duplicate identities and users from Workspace ONE using REST API's and PowerShell

Zimperium Delivery and Activation on Android Enterprise with Workspace ONE UEM Product Provisioning