public/api/Get-MBSAPIUser.ps1
function Get-MBSAPIUser { <# .SYNOPSIS Get backup user list. .DESCRIPTION Calls the GET request to https://api.mspbackups.com/api/Users. .EXAMPLE PS C:\> Get-MBSAPIUsers | ft ID Email FirstName LastName NotificationEmails Company Enabled LicenseManagementMode DestinationList -- ----- --------- -------- ------------------ ------- ------- -------------------- ----------- bf3206df-ad73-4cdc-96ad-d4e3afa66ebc backupuser Alex V2 {} Red Dragon HQ True 2 {@{ID=2f... bac8f288-6785-4bd0-897e-9cb859ed336e John@api.com John Down {john@api.com, notification@api.com} ApiTest True 2 {@{ID=48... .PARAMETER ID MBS User ID. Specify to filter by MBS User ID. .PARAMETER ProfileName Profile name used with MSP360 PowerShell for MBS API (set via Set-MBSApiCredential) .INPUTS None .OUTPUTS System.Management.Automation.PSCustomObject .NOTES Author: Alex Volkov .LINK #> [CmdletBinding()] param ( # [Parameter(Mandatory=$false, HelpMessage="User ID")] [string]$ID, # [Parameter(Mandatory=$false, HelpMessage="The profile name, which must be unique.")] [string] $ProfileName ) begin { } process { if ($ID) { $Users = Invoke-RestMethod -Uri ((Get-MBSApiUrl).Users+"/"+$ID) -Method Get -Headers (Get-MBSAPIHeader -ProfileName $ProfileName) }else{ $Users = Invoke-RestMethod -Uri (Get-MBSApiUrl).Users -Method Get -Headers (Get-MBSAPIHeader -ProfileName $ProfileName) } return $Users } end { } } |