Skip to main content

Run Powershell script

Run PowerShell scripts on your devices to automate tasks and streamline management.

 

Example script

Example of a common PowerShell script: A user 'password age' report, saved as an HTML file:

Get-ADUser -Filter "Enabled -eq 'True' -AND
PasswordNeverExpires -eq 'False'" -Properties
PasswordLastSet,PasswordNeverExpires,PasswordExpired |
Select DistinguishedName,Name,pass*,@{Name="PasswordAge";
Expression={(Get-Date)-$_.PasswordLastSet}} |sort
PasswordAge -Descending | ConvertTo-Html -Title
"Password Age Report" | Out-File c:\Work\pwage.htm

 

Deploy PowerShell script

Deploy scripts your way — schedule them with automation profiles or run them on demand from the Devices page or Agent Console. If you haven't yet created, uploaded, or generated a PowerShell script, see Create, upload, and generate scripts

Note:

  • The target device must have PowerShell installed and be running version 5.1 or later. To install PowerShell, see this Microsoft article
  • Disabling PowerShell on a device will deactivate both PowerShell functionality and PowerShell scripts within Atera.

 

To run a script:

1. From Devices (on the sidebar), click Manage > Run script on the device.

Devices page > Manage > Run script.jpg

The Run Script window appears.

2023-02-19_16-59-10.jpg

2. Find the script. Then click Run.

The Script execution summary window appears, displaying the script execution permissions (system or user), device name, exit code, and output.

2023-02-19_17-01-43.jpg

 

PowerShell execution policy

PowerShell's execution policy is a safety feature that controls the conditions under which PowerShell loads configuration files and runs scripts.

To check the current execution policy on a device, run:

 Get-ExecutionPolicy

Note: Atera bypasses the execution policy for PowerShell scripts in all cases, including when running scripts from the Devices page, Agent Console, automation profiles, and auto-healing scripts in threshold profiles.

 

 

 

Was this helpful?