Get A List Of All Policies For Your Organization and Their Schedules

  • 4 June 2021
  • 1 reply

Userlevel 5

This API script will get a list of all of your policies in your organization and put them in an Excel spreadsheet.

NOTE: Due to the way Excel auto-formats, the “schedule months” column may show in scientific notation due to the length. To fix the display of them, highlight the column, right-click on the column, click Format Column, choose Custom, then set the Type to 0.

Just set the following:

$apiKey = 'YOUR_API_KEY' - in your console, click on the three dots in the upper right, select KEYS, then copy your API key. Note that the API key is per admin user, so you and another admin in your console will have different API keys.

$orgID = 'YOUR_ORG_ID' - put your Org ID which can be found by looking at the URL on the device page and selecting the value after the “?o=”: [ ]. In this example the Org ID is 1234.

Example days per week :

For scheduling days of the week, there will be 7 digits with a trailing zero to mark the end. This starts on Sunday and ends on Monday. 1 represents ON and 0 represents OFF for each day of the week.


Every Day : 11111110

Mon/Wed/Fri only : 00101010

Example weeks per month:

Weeks are scheduled similarly to days, except there are 5 digits with a trailing zero. This starts on the 5th week of the month and ends with the 1st week of the month.


Every Week: 111110

2nd/4th weeks only: 010100

Example months per year:

Months continue the trend with 12 digits with a trailing zero. Starting with December and ending with January.


Every Month: 1111111111110

Mar/Jun/Sep/Dec = 1001001001000

# Replace the two variables below with your Org ID and your API key
$orgID = 'YOUR_ORG_ID'
$apiKey = 'YOUR_API_KEY'

# Replace if you'd like the output in another location
$expDir = 'C:\Temp\Policy_Schedules.csv'

# --------------------------------------

$servers = @()
$output = @()
$page = 0
$limit = 500

$headers = @{ "Authorization" = "Bearer $apiKey" }

while($true) {

$url = "$orgID&l=$limit&p=$page"
$resp = (Invoke-WebRequest -Method Get -Uri $url -Headers $headers).Content | ConvertFrom-Json

$output = $resp | Select-Object id, name, policy_type_name, `
@{ Name = 'schedule days'; Expression = { [Convert]::ToString($_.schedule_days,2) }}, `
@{ Name = 'schedule weeks'; Expression = { [Convert]::ToString($_.schedule_weeks_of_month,2) }}, `
@{ Name = 'schedule months'; Expression = { [Convert]::ToString($_.schedule_months,2) }}, `
schedule_time, notes, create_time, server_count

$servers += $Output
$page += 1

if($resp.Count -lt $limit) {


$servers | Export-Csv -Path $expDir -NoTypeInformation -Force

1 reply

Nice! Worked like a charm 👍