Skip to main content

How do you export current policies and groups in automox. I don’t see any options available to this in the platform.

 

Hello,

While we dont have an export button for the groups and policies, there are two API calls we can issue to collect that information:
https://developer.automox.com/openapi/axconsole/operation/getServerGroups/

https://developer.automox.com/openapi/axconsole/operation/getPolicies/

The request samples on the right hand side include the actual command you can copy and paste. (insert orgID and API key).


Do tou run this from the developer.automox.com and just change the org ID and api Key and should return the information I need ?


Yes, copy the code for the respective language you want to use and the substitute the variables.


 


Hello,

You will need to copy each line into a text file and save it as a .ps1 script. Once you do that, you would execute it by typing ‘./mygroupscript.ps1’ to get the results.

You could put it at the top of a powershell ISE window as well in the Script Pane
 

 


still get same error


i put the org ID and API key on the develoer.automox.com, its returning some results but I cant export or read it properly


I occasionally see the no response error when the org value is not in the original request. I have added my query and response here. Responses are JSON payloads and do require some formatting. There are some options in powershell to convert to CSV (example)

 

 


thanks, does this need to be edited

$url = "https://console.automox.com/api/servergroups?o=0000"


It doesn’t have to be, it is different in my example since i just grabbed another more detailed example I had handy.


got the json resulrs and when trying to convert its doent work.

i basically copied the results to notepad and renamed the file ,json

 


Hello,

I grabbed an example from a different community Worklet allowing the initial output to already be formatted much more cleanly. Append  ConvertFrom-Json  to the $response line:
 

 $response = (Invoke-WebRequest -Method Get -Uri $url -Headers $headers).Content | ConvertFrom-Json

echo $response 


Thanks Mark, making a lot of progress here. how can i export this into a csv for better readng


I got this to work with the following:

 $logFilePath = 'C:\Temp\groups.csv'
$response = (Invoke-WebRequest -Method Get -Uri $url -Headers $headers).Content | ConvertFrom-Json
$output += $response
$output | Export-Csv -Path $logFilePath -NoTypeInformation -Force

 


Reply