Sharon Kariwo

Scripting and Automation for Beginners

Scripting and Automation for Beginners

Introduction to Scripting and Automation for IT Professionals

Understanding Scripting

The first rule of scripting is never to call it "programming" in front of your developer friends. While scripting and programming share similarities, they are distinct. Scripting involves writing small programs to automate repetitive tasks, whereas programming is broader and encompasses the development of complex software systems.

GET A MENTOR TO HELP YOU ON YOUR TECH CAREER PATH

Learning scripting can be a valuable skill for IT professionals, whether you’re working in security, networking, or system administration. In this article, we’ll break down the fundamentals of scripting and demonstrate how it can streamline automation processes using tools like Ninite.

What is Ninite?

Ninite is a website that simplifies the installation of multiple applications. It's especially useful for IT professionals who need to set up new computers or reformat hard drives. Instead of installing each program manually, Ninite allows you to select the applications you need, and it handles the rest automatically.

Steps to Automate Software Installation with Ninite

  • Visit Ninite: Go to Ninite.com. This site offers a variety of applications, including browsers, compression tools, media players, and more.
  • Select Applications: Choose the programs you need. For this example, we’ll download Google Chrome and 7-Zip.
  • Get Your Ninite Installer: Click on "Get Your Ninite" to download the installer. Save this file to your desktop.
  • Run the Installer: Execute the downloaded Ninite installer. It will automatically download and install the selected applications without any further input from you.

Scripting the Installation Process

To further automate the installation, we can create a script that uses the Command Line Interface (CLI).

  • Download the MSI File: Go to the official 7-Zip website and download the 64-bit MSI installer.
  • Rename and Move the File: Rename the downloaded file to make it easier to reference, and move it to a convenient location such as your desktop.
  • Open Command Prompt: Run Command Prompt as an administrator to ensure you have the necessary privileges.
  • Command for Installation:
    • Type msiexec /i "C:\Users\<YourUsername>\Desktop\7zip.msi" /qn
    • This command tells the computer to install the 7-Zip MSI file quietly (/qn flag for silent installation).
  • Create a Batch File:
    • Open Notepad and enter the following script:

@echo off
msiexec /i "C:\Users\<YourUsername>\Desktop\7zip.msi" /qn
echo done

  • Save the file with a .bat extension, for example, install_7zip.bat.
  • Run the Batch File: Right-click the batch file and select "Run as administrator." This will execute the installation script automatically.

Benefits of Scripting

Scripting and automation save time and reduce errors in repetitive tasks. For IT professionals, learning scripting languages like PowerShell or Python can significantly enhance efficiency. PowerShell is particularly useful for managing Windows environments. So, you can automate PowerShell Scripts through Windows Task Scheduler. However, Python's versatility makes it suitable for a wide range of automation tasks.

Advanced Automation

For more complex scenarios, such as adding hundreds of users to Active Directory, you can create scripts that automate these processes. This not only speeds up the workflow but also ensures consistency and accuracy.

Conclusion

Scripting and automation are essential skills for modern IT professionals. Tools like Ninite simplify the initial setup of applications, while scripting languages like PowerShell and Python enable more advanced automation. By incorporating these skills into your toolkit, you can improve your productivity and streamline many of the tasks that are part of your daily routine.

For further learning, resources like ITProTV and various online tutorials can provide in-depth knowledge and practical examples. Start with the basics, and gradually explore more advanced scripting and automation techniques to fully leverage the power of these tools in your IT career.