Scripting & Automation for Beginners

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
the first thing to know about scripting is don't ever call it programming in front of your developer friends or they might have a mild meltdown no matter what part of it you get into whether that's security or networking or system administration learning scripting can be a valuable skill for you in this video i'm going to break down scripting at a very fundamental level and show you how this works with automation and that all starts by going to ninite.com this video is not sponsored by them but it's a tool that i have used for what seems like ever now i can't even tell you how many years i've used it but it's been an invaluable resource to me and other it professionals out there as well this is literally the first website that i go to anytime i build a new computer or i have to reformat my hard drive it's always going to nine night.com so that i can download everything that i need very very easily and simply so we'll go over and show you this real quick so you guys can understand and then we're gonna go ahead and download one of these programs and show you how we can actually automate the installation process with ninite it's doing everything for you so we can click on all of these different programs that we want to download so for the sake of this video we're just going to download google chrome and we're going to download 7-zip then all we have to do is click on get your ninite and then it should prompt us to download or save so we'll just do save as and we're going to go ahead and save this right on my desktop and we'll let that download so now that this is downloaded i'll go to my desktop and i'm just going to run this program so this actually goes through the process of downloading and installing google chrome and 7zip on your computer you literally don't have to touch anything after this point which is really awesome what we're witnessing right now is automation this is doing everything for us it's utilizing scripting to handle the download and installation of these files in this video we're going to download the file but we're going to build a script that will actually install it for us just through basically one or two clicks and we'll show you what we mean when we get to that point so as you can see on the screen here it's finished downloading and you can see here on our desktop we have google chrome installed and if we go here to our programs and we just type in seven we can see that we have 7-zip file manager installed now what i'm going to do is go ahead and go to my programs and features as you can see here this is a brand new vm there's literally nothing installed on it except for 7-zip google chrome and microsoft onedrive for whatever reason thanks microsoft anyway what we're going to do now is just go ahead and uninstall 7-zip because what i want to do is show you how we can actually automate this so now that i have google chrome installed i can open that up instead of edge and it makes me feel much better about my life and what we're going to do now is go to the 7-zip website so we can download the file so what we're going to do is type in 7-zip.org and this is the 7-zip website as you can see here and what we want to do is actually go ahead and download the msi file so we're going to go ahead and click on download and then we're going to look for the 64-bit architecture msi download here so if you're on 64-bit windows that is the version you would select if you're on 32-bit windows for whatever reason still you would download the 32-bit version msi install here as you can see here there's two extensions you may be very familiar with the exe extension that's executable extensions but msi is a alternate msi installer which is a microsoft installer this is something that is definitely heavily used in enterprise environments for things like microsoft deployment toolkit a ccm things like that that really kind of help automate the process of installing applications for you and just managing things so that's just something to keep in mind here so now that our file is downloaded i'm gonna go ahead and open it in its folder and the first thing i'm actually gonna do here is rename it to make things easier for us so i'm just gonna call this 7zip and now let's go over to our desktop and we're just gonna copy the 7zip msi file right over to our desktop again just to make things easy for us now the next thing that we want to do is we're going to create a new text file so we'll just go ahead and go to text document here and we'll open this bad boy up now we're going to get into the scripting part of it now the things that we're going to put in this text document can actually be run through the command line directly so what we need to do first is go down to our start menu or search bar here and type in cmd and what i want to do is right click on command prompt and run it as administrator because what we're going to be doing is installing a program and we want to have administrator rights in the command line to be able to do that or administrator privileges in order to do that so with the command line we can actually tell the computer what to do by giving it commands giving it text this text basically tells the computer what to do in the back end now to kind of familiarize yourself with things we saw kind of how ninite did it right where it actually ran through everything kind of on its own if we were to download 7-zip and run that program all on its own we would have to go through the next the next we want to select this location for the install next next complete right and then 7-zip would be installed well like we saw with nine night it does all of that for you in the command line that's exactly what we're going to do as well we're going to make the command line run everything for us on the back end so we don't have to touch anything so in the command line we can start typing msi exec so msi exec actually starts to build this communication with the computer's back end in order to tell it what to do next we want to make sure we have a space and then slash i slash i means install the next thing that we want to do is find the location of our file that we downloaded now i know that we put this file on our desktop so we need to actually know the location of that file so if we go to file explorer and we're going to go to this pc we're going to go to our c drive and now we want to go to users and i know that i'm on the remote account so if i click on remote and desktop and click up here in our address bar i can see that the location that the 7-zip file exists is in c users remote desktop so i want to make sure that i have that in here so what we're going to do in the command line is start with the parentheses here and we can type in c colon slash users slash type in remote and then another slash and now that we're at the remote folder we want to go to the desktop so we're going to go type in desktop put in another slash now we're on the remote desktop and we know that we have that 7zip file on our desktop so now all we need to do is type in 7zip.ms and then a parentheses now the next thing we need to do after the parentheses is do a space and then we can type in slash qn now qn is basically telling hey install this quietly don't let me see anything on the screen just do this for me so i don't have to touch anything and i don't have to see anything so now that we have this all typed out all we have to do is hit enter and it's going to run this for us so just give it a second after you click enter and then it should install everything in the background for you we can verify this by going down to our text bar here and typing in programs and features and there we go and we can see here we have 7zip installed as you saw it did everything for us all we had to do was type in this command in the command line so let's put all this in a text file and create a batch file so that we can automate this now the reason why we're creating a batch file is because again an enterprise environments when you utilize things like microsoft deployment toolkit you might utilize a batch file to help automate the process of installing applications for you so anyway we're going to close out all of this here and we're just going to make sure that we copy this from our command prompt so if you just highlight this and you do control c on your keyboard it will copy that for you because we want to make sure that we have that so we want to make sure that we create a new text file so you can go to your search bar here you could type in notepad or you could type in text file just go ahead and open that up and now what we want to do first is type in at and then echo space off then we're going to go ahead and go down to a new line and we're going to type in start this time and we're going to do space weight so what we're going to do next is just do control v because that we want to copy in that information from the command line and then we're going to go ahead and go to a new line and then we're going to go and type in echo space done now that we have this completed we're going to go ahead and go to file save as and we're going to go to the desktop and what we're going to do is just put in 7-zip dot b-a-t for the file name we want to make sure that the file type is under all files or otherwise you're going to save this file as 7zip.bat.txt so make sure that you have the file type set to all files and then we're going to go ahead and click on save now from our desktop here we have this 7-zip file and it has a different icon it has the gears on it well this is a batch file and we could see this by going to file explorer and then going to desktop and making sure that we have our view details on and we can see here 7-zip windows batch file that's what it is so it's a 7zip.bat and if we were to right-click on this and run as administrator it would run this file and do everything for us without us doing a thing so since we already had 7-zip installed we need to go back to uh programs and features and we need to remove 7-zip so that we can go through this process again so we can just go ahead and click on uninstall here and it should be a very quick process interesting i wouldn't say that normally happens but hey it worked it uninstalled all right so now that 7zip is no longer on our computer we can go back to our desktop and find that 7-zip batch file and right click on it and do run as administrator now the magic happens of course the uic is going to stop us from making this very easy for us thank you microsoft for your security features so we're just going to go ahead and click on yes and there it does that's all it did right everything just happened right then and there the program was installed everything ran just fine and now we're good to go as you can see here 7-zip is back in our programs and it was that easy so in a sense what we just did was we built a script that automated a process of installing our application for us so that is scripting and automation it definitely does get much more difficult than this once you start learning different scripting languages like powershell and python and of course once you start getting into automation things definitely can start to get more difficult from there but once you start building your foundation with scripting you can see how these pieces start to get put into place if you want to learn a little bit more about powershell i have a video where i walk you through how to install hundreds of users in active directory all through creating a script which automates the entire process for you so you don't have to go through and add a user and active directory one by one by one if you want to learn more powershell i would suggest utilizing a program like it pro tv use the coupon code itcq30 it saves you 30 they have powershell videos over there as well and of course youtube youtube is a great free resource to learn all of the things powershell and another great scripting language to learn is python i utilize python to create a scraping script and all this does is go out to indeed.com and it scrapes indeed for different job postings so it goes through and it'll search every single job posting for help desk every single job posting for cisco ccna and so on and so on that right there from my perspective and what it's doing is automation and scripting at its finest just being able to do exactly what i wanted to do automatically otherwise i would have to go out in indeed.com and i would have to type in help desk and do a search and make a notation of how many different jobs there were or type in cisco ccna and i would have to notate how many jobs there are instead with this script it actually does everything for me and it puts it all into an excel sheet for me so it has all of the numbers that correlate to all of the different searches that i did and all i have to do is click a button to run a python script once you learn scripting you can find ways to automate so many different things they're very valuable skills to have on your resume and they're very valuable skills just to have overall so if you're looking to learn scripting or automation i highly suggest it and i hope this video just helps introduce you to what it is in a sense it can be very basic and it can get very complex but it can all start just from running a few simple commands in your windows command line and just getting yourself familiar with the command line is something that i suggest everybody do anyway because you're going to find as an it professional you're often going to have a command line open up or powershell open up because you're going to be pinging things non-stop i promise you you'll be pinging something for one reason or another always and there are so many different things that you can do in the command line if you just type in help you'll get a full list of different things that you can do there are a ton of great resources out there to help you learn more about the command line i strongly suggest you get out on google and youtube and find the resource that works with you the best i hope this video helped kind of introduce you to these fundamentals of scripting and automation it was just supposed to be very basic it probably went on a lot longer than i wanted it to but thank you so much for watching and as always take it easy
Info
Channel: IT Career Questions
Views: 29,836
Rating: undefined out of 5
Keywords: IT Career Questions, cyber security, it careers, technology, information technology, it professional, scripting, automation, python, powershell, cmd prompt, command line, python scripting, python automation, powershell scripting, how to learn automation, how to learn scripting, best scripting language to learn 2022, scripting 2022, automation 2022
Id: j9MAMgyNpAU
Channel Id: undefined
Length: 13min 13sec (793 seconds)
Published: Thu Mar 03 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.