# SEARCH USERS BY USING SEARCH STRING. CAN CHANGE profile.email TO OTHER FIELDS $srchString = "theUserName" $org = "tenant.oktapreview.com" # Your tentant prefix - Ex. [tenant].oktapreview.com or [tenant]-admin.okta.com for production # May or may not need following Tls12 line [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 $api_token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" # Your API Token. You can generate this from Admin - Security - API # CAN CHANGE profile.email TO OTHER FIELDS $uri = "https://$org/api/v1/users?search=profile.email sw %22$srchString%22" $webrequest = Invoke-WebRequest -Headers @{"Authorization" = "SSWS $api_token"} -Method Get -Uri $uri $json = $webrequest | ConvertFrom-Json $usrInfo = $json #for all properties: $usrInfo #for specific properties: $usrInfo.status $usrInfo.profile.displayname $usrInfo.profile.employeenumber