For example you might have a VM and also you need to execute some scripts on VM then usually you’ve got to log in or ssh to your VM after which execute a command however there’s one other strategy to do it on Microsoft Azure and on this article, allow us to discover that.
Earlier than doing this we have to have a Digital Machine prepared. if you do not know the way to create a Digital Machine on Azure, You may undergo this text.
So allow us to undergo the run command, which we’ve got for our Digital Machines themselves. It’s type of a VM agent that enables us to run a script contained in the Digital Machine.
To get this, go to your VM overview web page and seek for the run command possibility contained in the operation.
So over right here, you might have completely different choices. You may carry out many operations like you’ll be able to execute an influence shell script, can disable home windows updates and set distant desktop port, and many others. So we’ve got plenty of choices over right here.
Now right here I’m going to make use of the choice of executing an influence shell script. I’m going to execute a command which is able to set up IIS(Web data companies) on this VM.
Simply to guarantee that IIS will not be put in on this machine I’m going to make use of the general public IP and verify whether it is put in as my HTTP and HTTPS port is open. As you’ll be able to see that IIS will not be put in on the machine and if it was put in, needs to be getting the house web page for Web data companies. however reveals the location cannot be reached.
So now go to Run Command once more and select RunPowerShellScript. Now enter the command you wish to execute and click on on Run. I’m going to execute this command.
import-module servermanager add-windowsfeature web-server -includeallsubfeature
So this command installs the characteristic of the webserver, together with all of its sub-features. so now it may run this energy shell script on the distant VM itself. it takes little time to finish the execution and as soon as it’s executed you will notice the next output.
Now, after ready for a while you’ll be able to see within the output that it’s full. So if I am going to the web page once more and if I hit on refresh you’ll be able to see the homepage for Web data companies.
So on this means, I did not join my machine utilizing SSH or RDP to execute command however I did it from right here itself and it’s fairly a useful instrument for the VM admins.
Thanks and I consider it’s useful.