Okay, we've just seen how to run a local Python script on a remote Ubuntu server, and also get the output returned by the Arista switch right in the windows command line. Now let's take a look at yet another scenario. This time, we have the script stored on the remote Ubuntu server. And we want to run that script and as the connectivity to the Arista switch from the windows 10 command line. Again, as we did in the previous lecture, we need to open up the windows command line as an administrator to be able to use the SSH client. Now let me write in the necessary line, and then we will discuss it, SSH, Mihai at 10 dot 10 dot 10 dot 100 open and close double quotes and in between the double quotes, Python three space slash home slash Mihai slash pink dot p y.
So this time we are establishing an SS Session from the local Windows operating system to the Ubuntu server at 10 dot 10 dot 10 dot 100 logging in with the same user name me Hi, and passing the command to be executed in the Linux terminal. By the way, if you're wondering where did this file and path came from this one right here, homie high ping dot p y. I previously created this script in my home folder on the Ubuntu machine. Let me show you. This is it right here ping.py. And this is the current directory slash home slash Mihai. If we look at the code, cat ping.py.
The code is basically the same as in the previous lecture. So again, we will simply ping the Arista switch and get a message in return. Going back to the windows command line, be sure to use Python three right here for the Linux command to have the script executed as Python three code. And also don't forget the double quotes surrounding the command. Now let's hit enter and see what happens again I am asked to enter the password by Thawne. And after entering the password, notice that the remote script has been successfully executed on the remote Ubuntu server from within the windows 10 command line.
And the result is basically the same successful ping to the rest of the virtual switch. I hope you enjoyed this lecture as well as the entire section and I will see you very soon