Hello @Marcus Assis
You can use Azure Automation to schedule and run PowerShell scripts on different Azure VMs at specific times. Here's a step-by-step guide to help you set this up:
Steps to Schedule PowerShell Script Using Azure Automation:
Create an Azure Automation Account:
- Go to the Azure portal and create a new Automation account.
- Configure the managed identity option for your new Automation account.
Grant Permissions:
- Assign the necessary permissions to the managed identity using Azure role-based access control (RBAC).
- Ensure the managed identity has permissions to access the VMs.
Create a PowerShell Runbook:
- In your Automation account, create a new PowerShell runbook.
- Add your PowerShell script to the runbook.
Create a Schedule:
- Go to the "Schedules" section under Shared Resources in your Automation account.
- Create a new schedule for each VM.
- Set the schedule to run at the specific times you want (e.g., 3 PM for Server A, 5 PM for Server B, 11 AM for Server C).
Link the Runbook to the Schedule:
- Link the PowerShell runbook to the schedules you created.
- Ensure the runbook is associated with the correct schedule for each VM.
Test the Setup:
- Test the setup to ensure that the scripts run at the scheduled times.
- Monitor the execution logs to verify that everything is working as expected.
Ref: https://zcusa.951200.xyz/en-us/azure/automation/automation-runbook-types
By following these steps, you can automate the execution of your PowerShell script on different Azure VMs at specific times. If you encounter any issues or need further assistance, feel free to ask!
If I have answered your question, please accept this as answer as a token of appreciation and don't forget to thumbs up for "Was it helpful"!