how to import users with csv files in powershell

Options
RyanMaeng
RyanMaeng Posts: 3 ✭✭
edited June 2023 in General questions

how to import users with csv files in powershell ?

Answers

  • RyanMaeng
    RyanMaeng Posts: 3 ✭✭
    edited September 2021
    Options

    I exported a list of users and i'd like to import a list of users (about 400users) with csv file in powershell.

    how can i import it ?

    below is the code that i exported a list of users

    $csvFile = "C:\...\test.csv"

    $accessToken = "...."

    $usersResponse = Invoke-RestMethod -Uri "https://webapi.teamviewer.com/api/v1/users?full_list=true" -Method Get -Headers @{authorization = "Bearer $AccessToken"}

    $usersResponse.users | Export-Csv -Path $csvFile -Delimiter ',' -NoTypeInformation -Encoding UTF8