Skip to main content
Solved

policies and group export


Forum|alt.badge.img

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

 

Best answer by MarkH-Automox

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

 

View original

Forum|alt.badge.img

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).


Forum|alt.badge.img

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 ?


Forum|alt.badge.img

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


Forum|alt.badge.img

 


Forum|alt.badge.img

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
 

 


Forum|alt.badge.img

still get same error


Forum|alt.badge.img

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


Forum|alt.badge.img

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)

 

 


Forum|alt.badge.img

thanks, does this need to be edited

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


Forum|alt.badge.img

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


Forum|alt.badge.img

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

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

 


Forum|alt.badge.img

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 


Forum|alt.badge.img

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


Forum|alt.badge.img

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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings