KNOWLEDGE PORTAL
Summary
**Do not use in production environment without professional assistance**
When working with Secret Server it is important to know what groups and roles a user is part of. This information can be pulled using the below API.
To view this script on the Cyberhill Github page, click here.
Function Get-SSUserById { Param ( [Parameter(Mandatory=$true, Position=0)] [string] $URI, [Parameter(Mandatory=$true, Position=1)] [string] $APIKey, [Parameter(Mandatory=$true, Position=2)] [int] $UserID, [Parameter(Mandatory=$False, Position=3)] [boolean] $includeInactive = $False ) try { $headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]" $headers.Add("Authorization", "Bearer $APIKey") $URI = "$URI/api/v1/users/$UserID" + "?" + "includeInactive=$includeInactive" $secrets = Invoke-RestMethod $URI -Method Get -Headers $headers return $secrets } catch { $result = $_.Exception.Response.GetResponseStream(); $reader = New-Object System.IO.StreamReader($result); $reader.BaseStream.Position = 0; $reader.DiscardBufferedData(); $responseBody = $reader.ReadToEnd() | ConvertFrom-Json Write-Host "ERROR: ($responseBody.error)" return; } }
You might also be interested in
Folder Information
When creating a folder, it is just as important to know what the API is looking for as it is to be able to make the API call to create…
LEARN MORE
Getting a Token for Use With the API
To start using the API you need to get a token. There are a few ways to do this.
LEARN MORE
Pulling a Secret from Secret Server by ID
One of the most common things clients look to do when scripting is to pull a secret from Secret Server.
LEARN MORE