In order to run a PowerShell Script, you'll need to upload a PowerShell ( *.ps1 ) file into the scripts repository, which can be found in Admin (on the side panel) > Scripts.
Example of a common PowerShell Script: A user 'password age' report, saved as an HTML file:
PS C:\> Get-ADUser -Filter "Enabled -eq 'True' -AND
PasswordNeverExpires -eq 'False'" -Properties
PasswordAge -Descending | ConvertTo-Html -Title
"Password Age Report" | Out-File c:\Work\pwage.htm
Deploy PowerShell script
There are two ways to deploy the script:
- Agent console > Manage > Scripts
- Automated profile
To upload a script:
1. From Admin (on the sidebar), click Scripts.
Note: You can also access the menu from the Devices page.
The Scripts page displays.
2. Click Upload script. The Upload Script window appears.
3. Upload the script file from your PC ( *.bat, *.msi, *.exe, *.ps1 ). Then click Upload.
To apply a script to an agent:
1. From Devices (on the sidebar), click Manage on the device.
2. Click Run script. The Run Script window appears.
3. Find the script. Then click Run. The Summary window appears, displaying the exit code and output.
PowerShell Execution Policy
PowerShell's execution policy is a safety feature that controls the conditions under which PowerShell loads configuration files and runs scripts. You can find more details on this execution policy here.
To get the current execution policy on a machine, you can use the cmdlet Get-ExecutionPolicy
Atera will bypass the Execution policy on Powershell scripts in all situations: when live-managing PowerShell, when executing a script via an IT Automation profile, when running scripts immediately on a machine and when using the auto-healing scripts within a Threshold profile item.