Public/Kandji-GetADEDevices.ps1
function Kandji-GetADEDevices { <# .SYNOPSIS Returns an array of all enrolled devices in Kandji .DESCRIPTION Helper function to return all enrolled devices in Kandji .PARAMETER Token Kandji API token that can retrieve devices .PARAMETER SubDomain The SubDomain of your Kandji instance .PARAMETER ADEServerName The server Name of the ADE Integration .EXAMPLE Input String: <Token> Input String: <SubDomain> Input String: <Server Name> Return Array: [devices] .NOTES This returns all devices regardless of status .FUNCTIONALITY Powershell Language #> [CmdletBinding()] param ( [Parameter( Position = 0 )][string]$Token, [Parameter( Position = 1 )][string]$SubDomain, [Parameter( Position = 2 )][string]$ADEServerID ) $uri = "https://$SubDomain.api.kandji.io/api/v1/integrations/apple/ade/$ADEServerID/devices/" $headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]" $headers.Add("Authorization", "Bearer $Token") $ProgressPreference = 'SilentlyContinue' $devices = (Invoke-WebRequest -Uri $uri -Headers $headers -Method Get).Content | ConvertFrom-Json -Depth 100 $ProgressPreference = 'Continue' return $devices.results } |