Running a PowerShell Script when Machine boots

Gourav Kumar 1 Reputation point
2021-02-02T08:27:23.57+00:00

Hi All,

I want to run a PowerShell script when a machine (WVD) boots up.
I have used automation account for multiple things however I am missing the catch here that is "run the code when machine boots up".

Can someone please help me to achieve this.

As always thanks in advance :)

Regards,
Gourav

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
9,013 questions
Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
1,366 questions
Windows for business Windows Server User experience PowerShell
{count} votes

2 answers

Sort by: Most helpful
  1. Kasun Rajapakse 431 Reputation points
    2021-02-02T16:34:30.01+00:00
    1 person found this answer helpful.
    0 comments No comments

  2. MotoX80 36,291 Reputation points
    2021-02-02T17:34:54.827+00:00

    The classic approach would be to use the Task Scheduler and set a trigger for "At system startup". In the Actions tab set it to run Powershell.exe and in the Arguments field put the full path to the script that you want to run. On the General tab, specify the user that the script will run as, or just use System.

    63087-capture.jpg

    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.