Get ready to supercharge your IT skills and become a PowerShell rockstar! 🎸 In this PowerShell Tutorial for Beginners, we’ll take you on a thrilling journey through the world of PowerShell, the ultimate command-line shell and scripting language that will transform the way you manage systems and automate tasks. 💻✨
🚀 Launching PowerShell: Master the art of launching PowerShell on Windows 10/11 and become a command-line ninja!
💻 Simple Scripting Examples: Put your newfound knowledge into practice with real-world scripting examples that will make you feel like a PowerShell wizard.
🔥 Deepening Your Understanding: Take your PowerShell skills to the next level by exploring advanced concepts, best practices, and the vibrant PowerShell community.
So, buckle up and get ready for an exhilarating ride through the world of PowerShell! Let’s dive in and unlock the secrets to becoming a true PowerShell rockstar! 🚀🎸💻
PowerShell Tutorial for Beginners in 2024

What is PowerShell?
PowerShell is essential for automating tasks, managing systems, and boosting your productivity.
PowerShell is an object-oriented, interactive command-line shell and scripting language built on the .NET framework. It provides a comprehensive set of tools and utilities for automating tasks, managing configurations, and interacting with various systems and services, including Windows, Azure, and Office 365.
Advantages of PowerShell over Command Prompt:
- The use of Object-Based Scripting: Unlike Command Prompt, which operates with text, PowerShell works with .NET objects, allowing you to manipulate and control system components in a more sophisticated and flexible way.
- A much more Comprehensive Scripting Environment: PowerShell includes a scripting language that’s more advanced than the batch language used in Command Prompt. It supports complex functions, structured error handling, and advanced workflow capabilities.
- Integrated Scripting Environment (ISE): PowerShell ISE provides a graphical user interface with script editing, debugging, and execution facilities, which are not available in the traditional Command Prompt. Visual Code also offers support for PowerShell so ISE is not needed if you use that.
- Extensibility: Users can extend PowerShell’s functionality by writing their own cmdlets and modules or by using those created by others.
Basics of PowerShell:
- Cmdlets are the native commands used in the PowerShell environment. They follow a verb-noun naming convention, like
Get-Help,Copy-Item, etc. Each cmdlet can be customized with various parameters to perform its task. - PowerShell is similar to Command Prompt but leverages more powerful cmdlets.
For instance,Get-ChildItemlists items in a directory, similar todirin Command Prompt, but with more detailed output and options.
Methods to Launch PowerShell on Windows 10/11

Option 1) Call Powershell by typing “powershell” into a command line window
Option 2)
Step 1. Right click the Start Menu Icon (bottom left corner of the screen

Step 2. After right clicking, from the list select Windows PowerShell


Alternatively, search for powershell, in the windows search menu. You could also Run powershel like so

Having the Tool pinned to your Task Bar is quite useful, highty recommend that too. Having both CMD and PowerShell pinned at the same time could be considered pointless. As you can alwayss move been each of these languages from the same window:

5 PowerShell Commands Every IT Apprentice Should Know
As an IT apprentice, mastering PowerShell is crucial for managing systems efficiently. Here are five powerful PowerShell commands that will elevate your scripting game:
Simple Scripting Examples: (see more posts for scripts!)
- Creating a Folder and Moving Files
# Creates a new directory
New-Item -Path 'C:\MyFolder' -ItemType Directory
# Moves all text files from one directory to another
Get-ChildItem -Path 'C:\OldFolder\*.txt' | Move-Item -Destination 'C:\MyFolder'2. Checking Disk Usage
# Displays disk usage
Get-PSDrive C | Select-Object Used, Free3. Fetching System Information
# Fetches system information
Get-ComputerInfo | Select-Object CsModel, CsManufacturer, WindowsProductNameCongratulations, on taking your first steps with our PowerShell Tutorial for Beginners! 🎉
By starting with PowerShell, you’ve opened up a world of possibilities for enhancing your productivity and tackling system management and automation tasks. 💻✨
As an IT apprentice, investing time in learning PowerShell will be invaluable for your career growth.
📈 Your dedication to mastering this powerful tool will set you apart and open up new opportunities.
To continue your PowerShell journey, it’s essential to keep practicing and applying your skills to real-world scenarios. Embrace the challenges and watch your PowerShell proficiency grow. 💪 https://theitapprentice.com/powershell/
Remember, the PowerShell community is here to support you. Engage with online resources, join forums like powershell.org, and connect with other PowerShell enthusiasts to expand your knowledge and stay up-to-date with the latest developments. 🌐 You can visit https://learn.microsoft.com/en-us/training/modules/introduction-to-powershell/ for an introduction to learning PowerShell via their interactive quizzes and courses.
If you already know batch or standard cmd commands for Windows, now is the perfect time to learn their PowerShell equivalents. Embrace the power and flexibility that PowerShell offers and boost your efficiency. ⚡
With consistent practice and persistence, you’ll soon become proficient in leveraging PowerShell for automating tasks and managing systems effectively. Your skills will be highly valued, and your IT career will benefit greatly. 🌟
Happy Scripting ☕
Join Our Community!
🌟 Get exclusive insights and the latest IT tools and scripts, straight to your inbox.
🔒 We respect your privacy. Unsubscribe at any time.
Let’s start learning Powershell Lessons. First, we will learn:
What is PowerShell?
Why Use Powershell?
Here, are some important reason for using Powershell:
- Powershell offers a well-integrated command-line experience for the operation system
- PowerShell allows complete access to all of the types in the .NET framework
- Trusted by system administrators.
- PowerShell is a simple way to manipulate server and workstation components
- It’s geared toward system administrators by creating a more easy syntax
- PowerShell is more secure than running VBScript or other scripting languages
PowerShell History
PowerShell first version 1.0 was released in 2006. Today, PowerShell is at version 7.2. As the year and version gone by, PowerShell’s capabilities and hosting environments grew significantly.
Let See Version wise History of Powershell:
- PowerShell version 1 supported the local administration of Windows Server 2003
- PowerShell 2.0 was integrated with Windows 7 and Windows Server 2008 R2. This version supports for remoting and enhances the capabilities of PowerShell like transactions, background jobs, events, debugging, etc.
- PowerShell 3.0 was released as an internal part of the Windows management framework. It was installed on Windows 8 and Windows Server 2012. You can add and scheduled jobs, session connectivity, automatic module loading, etc.
- PowerShell 4.0 was shipped with Windows 8.1 and Windows Server 2012 R2. In this version added support for desired state configuration, enhanced debugging, network diagnostics.
- PowerShell 5.0 was released as internal part of Windows management framework 5. The feature offers in this version are remote debugging, class definitions, .NET enumerations, etc.
- PowerShell 7.2 was released. It is built on .NET 6.0. This version offers new operators, simplified and dynamic error view, automatic new version notifications, etc.
Next in this Powershell scripting tutorial, we will learn about features of Powershell.
Features of Powershell
- PowerShell Remoting: PowerShell allows scripts and cmdlets to be invoked on a remote machine.
- Background Jobs: It helps you to invoked script or pipeline asynchronously. You can run your jobs either on the local machine or multiple remotely operated machines.
- Transactions: Enable cmdlet and allows developers to perform
- Evening: This command helps you to listen, forwarding, and acting on management and system events.
- Network File Transfer: Powershell offers native support for prioritized, asynchronous, throttled, transfer of files between machines using the Background Intelligent Transfer Service (BITS) technology.
How to launch PowerShell
Now in this Powershell script tutorial, we will learn how to launch Powershell on Windows OS.
Step 1) Search for PowerShell in Windows. Select and Click

Step 2) Power Shell Window Opens

PowerShell Cmdlet
A cmdlet which is also called Command let is a is a lightweight command used in the Window base PowerShell environment. PowerShell invokes these cmdlets in the command prompt. You can create and invoke cmdlets command using PowerShell APIS.
Cmdlet vs. Command
- Cmdlets are .NET Framework class objects It can’t be executed separately
- Cmdlets can construct from as few as a dozen lines of code
- Parsing, output formatting, and error presentation are not handled by cmdlets
- Cmdlets process works on objects. So text stream and objects can’t be passed as output for pipelining
- Cmdlets are record-based as so it processes a single object at a time
Most of the PowerShell functionality comes from Cmdlet’s which is always in verb-noun format and not plural. Moreover, Cmdlet’s return objects not text. A cmdlet is a series of commands, which is more than one line, stored in a text file with a .ps1 extension.
A cmdlet always consists of a verb and a noun, separated with a hyphen. Some of the verbs use for you to learn PowerShell is:
- Get — To get something
- Start — To run something
- Out — To output something
- Stop — To stop something that is running
- Set — To define something
- New — To create something
Get-Help: Help about PowerShell commands and topics
Example: Display help information about the command Format-Table
Get-Help Format-Table

Get-Command: Get information about anything that can be invoked
Powershell Script Example: To generate a list of cmdlets, functions installed in your machine
Get-Command

Get-Service: Finds all cmdlets with the word ‘service’ in it.
Example: Get all services that begin with “vm”
Get-Service "vm*"

Get- Member: Show what can be done with an object
Example: Get members of the vm processes.
Get-Service "vm*" | Get-Member

- Get Module Shows packages of commands
- Get Content This cmdlet can take a file and process its contents and do something with it
- Get- get Finds all cmdlets starting with the word ‘get-
Example: Create a Folder
New-Item -Path 'X:\Guru99' -ItemType Directory

Powershell Data types

Special Variables
| Special Variable | Description |
|---|---|
| $Error | An array of error objects which display the most recent errors |
| $Host | Display the name of the current hosting application |
| $Profile | Stores entire path of a user profile for the default shell |
| $PID | Stores the process identifier |
| $PSUICulture | It holds the name of the current UI culture. |
| $NULL | Contains empty or NULL value. |
| $False | Contains FALSE value |
| $True | Contains TRUE value |
PowerShell Scripts
Powershell scripts are store in .ps1 file. By default, you can’t run a script by just double-clicking a file. This protects your system from accidental harm. To execute a script:
Step 1: right-click it and click “Run with PowerShell.”

Moreover, there is a policy which restricts script execution. You can see this policy by running the Get-ExecutionPolicy command.
- Restricted— No scripts are allowed. This is the default setting, so it will display first time when you run the command.
- AllSigned— You can run scripts signed by a trusted developer. With the help of this setting, a script will ask for confirmation that you want to run it before executing.
- RemoteSigned— You can run your or scripts signed by a trusted developer.
- Unrestricted— You can run any script which you wants to run
Steps to Change Execution Policy

- Get-ExecutionPolicy
- Set-executionpolicy unrestricted
- Enter Y in the prompt
- Get-ExecutionPolicy

First PowerShell Script
Write-Host "Hello, Guru99!"
PowerShell Scripts have an extension ps1. Save the file as FirstScript.ps1

In Powershell, call the script using the command
& "X:\FirstScript.ps1"

What is PowerShell ISE?
The Windows PowerShell Integrated Scripting Environment(ISE) is the default editor for Windows PowerShell. In this ISE, you can run commands, writer test, and debug scripts in an in a window base GUI environment. You can do multiline editing, syntax coloring, tab completion, selective execution and lots of other things.
Windows PowerShell ISE also allows you to run commands in a console pane. However, it also supports panes that you can use to simultaneously view the source code of your script and other tools which you can plug into the ISE.
You can even open up multiple script windows at the same time. This is specifically useful when you are debugging a script which uses functions defined in other scripts or modules.

The same script we created in notepad, can be created in ISE
- Paste code into the editor
- Save Script
- Use F5 to run the script
- Observe output in the console

Get-WmiObject -Class Win32_OperatingSystem –ComputerName localhost | Select-Object -Property CSName,FreeVirtualMemory

PowerShell Concepts
Now in this Powershell for beginners tutorial, we will learn about important Powershell concepts:
| Cmdlets | Cmdlet are build-command written in .net languages like VB or C#. It allows developers to extend the set of cmdlets by loading and write PowerShell snap-ins. |
| Functions | Functions are commands which is written in the PowerShell language. It can be developed without using other IDE like Visual Studio and devs. |
| Scripts | Scripts are text files on disk with a .ps1 extension |
| Applications | Applications are existing windows programs. |
| What if | Tells the cmdlet not to execute, but to tell you what would happen if the cmdlet were to run. |
| Confirm | Instruct the cmdlet to prompt before executing the command. |
| Verbose | Gives a higher level of detail. |
| Debug | Instructs the cmdlet to provide debugging information. |
| ErrorAction | Instructs the cmdlet to perform a specific action when an error occurs. Allowed actions continue, stop, silently- continue and inquire. |
| ErrorVariable | It specifies the variable which holds error information. |
| OutVariable | Tells the cmdlet to use a specific variable to hold the output information |
| OutBuffer | Instructs the cmdlet to hold the specific number of objects before calling the next cmdlet in the pipeline. |
Advantages of using PowerShell script
- PowerShell scripts are really powerful and could do much stuff in fewer lines.
- Variables are declared in the form $<variable>
- Variables could be used to hold the output of command, objects, and values.
- “Type” of a variable need not be specified.
PowerShell Vs. Command Prompt
| PowerShell | Command Prompt |
|---|---|
| PowerShell deeply integrates with the Windows OS. It offers an interactive command line interface and scripting language. | Command Prompt is a default command line interface which provided by Microsoft. It is a simple win32 application that can interact and talk with any win32 objects in the Windows operating system. |
| PowerShell uses what are known as cmdlets. It can be invoked either in the runtime environment or the automation scripts. | No such features offer by command prompt. |
| PowerShell considers them as objects. So the output can be passed as an input to other cmdlets through the pipeline. | Command Prompt or even the *nix shell, the output generated from a cmdlet is not just a stream of text but a collection of objects. |
| The PowerShell is very advanced regarding features, capabilities and inner functioning. | Command prompt is very basic. |
Applications of Powershell
You can surely log in to each server and see if they have that service install and running or not. However, it certainly takes a lot of human errors as your staff needs to spend lots of time on this non-productive process.
However, if you use PowerShell, then you could complete this task in just a few minutes. That’s because the entire operation is done with a single script which gathers information about the services running on the servers.
Summary
- Windows PowerShell is object-oriented automation engine and scripting language
- Powershell offers a well-integrated command-line experience for the operation system
- PowerShell first version 1.0 was released in 2006
- PowerShell allows scripts and cmdlets to be invoked on a remote machine
- PowerShell is pre-installed in all latest versions of Windows
- A cmdlet is a lightweight command used in the Window base PowerShell environment
- Get, Start, Out, Stop, Set, New are important PowerShell commands
- Boolean, Byte, Chat, Decimal, Decimal, Long are important Data Type of PowerShell
- $Error. $Host, $Profile, $PID, $PSUICulture, $NULL are some special variable used in PowerShell
- The Windows PowerShell Integrated Scripting Environment(ISE) is the default editor for PowerShell
- PowerShell deeply integrates with the Windows OS whereas Command Prompt is a default command line interface which provided by Microsoft
- PowerShell has become an ideal choice for IT administrators as it eases management operation and effort in large corporate networks




