Power Shell Tutorial for Beginners
Posted by Superadmin on January 28 2023 15:41:48

Power Shell Tutorial for Beginners

 

 

What is Windows Powershell?

 

Windows PowerShell is one of the free scripting applications preinstalled in Windows machine or directly can be downloaded from Windows official website. From windows 7 onwards Microsoft introduced Powershell.ise where we can test our scripts and later save them in .ps1 format. Although there are many advantages of using Powershell our main use is to automate things so that we can save time and manual work.

Today, Powershell comes with great cmdlets that can be used to run in any specific application-related servers that can be SQL, Sharepoint, etc.  Well, everything can be automated with Powershell. Although sometimes it is highly recommended to do things manually as the world is progressing to achieve automation and cut manual tasks it is really important to cope with moving technologies.

 

 

How to open Powershell?

 

In this section, we will understand How to open Powershell from Windows.

There are many ways to open Powershell let’s check one by one .

 

Step 1) From the start menu, just search for Powershell and there you go.


Open Powershell

 

 

Step 2) From the command prompt (cmd).

 

 

powershell and cmd

 

 

Step 3) From Run.exe, we just need to type Powershell and the Powershell window will open.

 


run-powershell

Why use Powershell?

Below are some of the reasons you should use 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.
  • User-friendly and easy to understand.

 

 

How to find out which Powershell Version is running?

Below is the command which we will use to find out the Powershell Version. This is one of the basic commands we will learn in today’s post.

$PSVersionTable
Find Powershell Version

How to run a Powershell script?

  1. Launch Windows PowerShell, and wait a moment for the PS command prompt to appear.
  2. Navigate to the directory where the script lives

    PS> cd C:\my_path\yada_yada\
    
  3. Execute the script:

    PS> .\run_import_script.ps1
    

Or

You can run the PowerShell script from cmd.exe like this:

powershell -noexit "& ""C:\run_import_script.ps1"""