Share via

How do I control a VM with CLI commands?

BaeSam 26 Reputation points
2022-06-27T06:39:51.93+00:00

After searching for a long time, I still haven't found a solution. help..plz

  1. Create an image-resource with DevTest Labs.
  2. Create many VMs with the created image-resource.
  3. I want to run a specific py (python) program installed on the desktop with a CLI command on the created windows10 VM.
    Or I want to run a specific py(python) program in a different way.
Azure Virtual Machines
Azure Virtual Machines

An Azure service that is used to provision Windows and Linux virtual machines.

0 comments No comments

Answer accepted by question author

srbhatta-MSFT 8,591 Reputation points Microsoft Employee
2022-06-27T10:12:51.68+00:00

Hello @BaeSam ,
Thanks for reaching out to Microsoft QnA.
We don't have the documentation for doing the above usng CLI, but we have it for PowerShell. Can you please refer to the PowerShell documentation and convert it to CLI as per your own requirements.
Here is the document link - Devtest-lab-create-custom-image-from-vhd-using-powershell.
Also, you can create the image out of a Azure lab VM using the Azure Portal.
Now, when you create new lab VMs using the same image, the Python Program will come by default in all those newly created VMs form the same custom image. Post that, you can use your lab VM (by logging into the VM) and run the Python program from within the VM after installing the MSI for Azure CLI from here.

Hope this helps. Looking forward to your response. Could you please tag me in your response for me to able to get a notification.
Also, if I have misunderstood your ask by any chance, kindly revert back. Thank you.

----------------

Please accept as answer and upvote if the information provided above is helpful.

Was this answer helpful?


0 additional answers

Sort by: Most helpful

Your answer

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