To stay updated on your favorite discussions, please create an account or log in. Then, click the Bookmark icon to subscribe and receive notifications.

Connect to PSB API with Powershell

DannyMalvang W/ Alumni Posts: 10 Security Scout

I just got access to an API key and would like to pull some data from the PSB portal and compare with AD. Sadly I cannot figure out how to connect via Powershell.

Found this:

where it seemed to be solved but the solutions isn't shown in the posts.

Can anyone point me in the right direction?


Best Answer


  • JamesC
    JamesC W/ Partner, W/ Staff, W/ Moderator Posts: 526 Moderator

    Hi Danny

    The official help documents and Quick Start Guide can be found here. They contain the full documentation as well as examples of information requests.

  • PetriKuikka
    PetriKuikka W/ Alumni Posts: 237 Threat Terminator

    Hi @DannyMalvang,

    did you get the problem sorted out? If not you can drop the calls you are trying to me in private message and I can check what is going wrong.


  • DannyMalvang
    DannyMalvang W/ Alumni Posts: 10 Security Scout


    I got it working with your help, but mostly I was using a - instead of a _ in the username. DOH! It helps if the credentials is correct

    Heres what I did:

    $url = "<API URL>"

    $apiKey = 'XXXXXXXXXXX'

    $auth = @{

     'X-API-Key' = $apiKey


    $body = @{

     'username' = ""

     'password' = "123456789"


    $token = (invoke-restmethod -Uri "$url/authentication/login" -Method Post -Headers $auth -Body $body).token

    Now I can use wget to get all computers:

    wget -Uri "$url/partners/1234/reports/computers" -Method Get -Headers @{ 'x-api-key' = $apiKey ; Authorization = "Bearer $Token"}

    Now I only need to figure out how to reformat the data to something usefull

This discussion has been closed.