functions/Get-DrmmSiteDevices.ps1
function Get-DrmmSiteDevices { <# .SYNOPSIS Fetches the devices records of the site identified by the given site uid. .DESCRIPTION Returns device settings, device type, device anti-virus status, device patch Status and UDF's. .PARAMETER siteUid Provide site uid which will be use to return this site devices. #> # Function Parameters Param ( [Parameter(Mandatory=$True)] $siteUid ) # Declare Variables $apiMethod = 'GET' $maxPage = 250 $nextPageUrl = $null $page = 0 $Results = @() do { $Response = New-ApiRequest -apiMethod $apiMethod -apiRequest "/v2/site/$siteUid/devices?max=$maxPage&page=$page" | ConvertFrom-Json if ($Response) { $nextPageUrl = $Response.pageDetails.nextPageUrl $Results += $Response.devices $page++ } } until ($nextPageUrl -eq $null) # Return all site devices return $Results } |