https://community.atera.com/discussion/comment/1850#Comment_1850
Wow, looks like they spruced it up a little last time I looked!
Here was my sample for PowerShell if anyone finds it useful:
$api_Key = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx" #Standard Header
$headers = @{
'X-API-KEY' = $api_key
} #Get All Agents
$machine_info = Invoke-RestMethod -Headers $headers -Uri https://app.atera.com/api/v3/agents/ | Select-Object -ExpandProperty items Write-Output $machine_info #Get Local Agent Info By Name
$machine_info = Invoke-RestMethod -Headers $headers -Uri https://app.atera.com/api/v3/agents/machine/$env:computername | Select-Object -ExpandProperty items Write-Output $machine_info #Get Agent Info by Agent ID
$agentID = 4 $machine_info = Invoke-RestMethod -Headers $headers -Uri https://app.atera.com/api/v3/agents/$agentID Write-Output $machine_info #Create an alert from a local machine
#Get the local agent information from the API
$machine_info = Invoke-RestMethod -Headers $headers -Uri https://app.atera.com/api/v3/agents/machine/$env:computername | Select-Object -ExpandProperty items #Build the alert
$title = "Incorrect Time"
$additional_info = "The agents time is off by more than 5 minutes"
$severity = "Warning" #Available Options: ['Information', 'Warning', 'Critical']
$alert_category = "General" #Available Options: ['Hardware', 'Disk', 'Availability', 'Performance', 'Exchange', 'General'] $postParams = @{
DeviceGuid = $machine_info.DeviceGuid;
CustomerID = $machine_info.CustomerID;
Title = $title;
Severity = $severity;
AdditionalInfo = $additional_info;
AlertCategoryID = $alert_category
} #Create the Alert
Invoke-RestMethod -Headers $headers -Uri https://app.atera.com/api/v3/alerts -Method POST -Body $postParams #Create a ticket
#Build the ticket
$ticket_title = "API Test"
$ticket_description = "Ticket to test the API"
$end_user_id = "1" #Target a specific user $postParams = @{
TicketTitle = $ticket_title;
Description = $ticket_description;
EndUserID = $end_user_id
} #Create the ticket
Invoke-RestMethod -Headers $headers -Uri https://app.atera.com/api/v3/tickets -Method POST -Body $postParams
Create Alert from powershell

Hi Guys,
I would like to know if it is possible to create an alert from a powershell script.
I tried to use api but I received a warning like : "Unable to build a secure connection.."
Thank you for your support.
Ciao
Comments
-
Hi @panzerifabio ,
with PowerShell you can write an Eventlog and based on the Eventlog you can raise an alert :)
1 -
Windows event log alert, or alert in Atera ?
If you want to use the API to create an Alert in Atera, here is a starter for you.
0 -
Thank you.
@mjones I used this script for test but I received error code 400 bad request.
What's wrong?
Thank you
0 -
Be careful when using the API from a client pc via PowerShell as it contains the api key in clear text.
Someone could access all your data by capturing the api key including the option to edit/ remove your data.1 -
Definitely this!
0 -
You have to add your API key to the script for it to work.
If you arent familiar with Powershell or API access, I would not recommend this route.Make sure not to post your API key here, as it gives full access to your system.
1
Topics
- All Topics
- 61 Getting started
- 27 Read before posting
- 9 Meet and greet
- 330 General
- 77 News and announcements
- 2 Swag
- 6 Roadmap updates
- 1 Product Survey
- 101 Resources
- 1 Onboarding
- 17 Knowledge Base
- 23 Webinars
- 1 Shared Script Library
- 3 Blog
- 24 Pro Tips
- 30 Got an idea?
- 3 Atera Academy
- 8 ActionAI
- 5 Copilot
- 223 Remote Monitoring and Management
- 91 Remote Monitoring
- 29 Patch Management
- 120 Professional Services Automation
- 72 Helpdesk
- 18 Billing
- 24 Reporting
- 44 Integrations & add-ons
- 23 Integrations
- 12 Add-ons
- 115 Scripting and automations
- 64 Scripts
- 36 Automations