run script from powershell

Here we read about methods to run a script from Powershell in Microsoft Windows. PowerShell is a tool to scripting language in you’ll use in Windows to automate various tasks. you’ll run PowerShell scripts from the normal Windows instruction or using PowerShell’s own prompt. confirm to only run PowerShell commands that you’ve got written and debugged or ones from sources you trust, since ones from other sources can do belongings you might not want on your computer.

On Windows, PowerShell is just like “CMD” (windows command prompt). PowerShell designed to run command’s and scripts with the moto to change system setting and tasks.

Let’s see how to create PowerShell script file on Windows.

There are two better ways to make PowerShell script-

  1. By using Integrated Scripting Environment (ISE) console. (Note: Which come with every windows installation it means you do not need to install it as third party application as simple as that.)
  2. By using any TextEditor like Notepad, Notepad++ etc.

Give a look to Method 1 –

By Using Integrated Scripting Environment (ISE) console.

  1. Its very simple just open Start Menu.
  2. Search for PowerShell ISE and Run it as Administrator.
  3. Now click on File menu and click on New button.

So here new empty ps1 file have been created. ps1 is the extension name of file.

Now just write a PowerShell script you want to run and use it whenever you need it.

Script Example –

Command : – Write-Host "Welcome! Your first script run successfully"

Method 2 :-

  1. Make Script using Text Editor-
  2. Open Start and search for Notepad.
  3. write your sample code like this-
  4. Save it as demo.ps1 and enjoy you have successfully created your first Script file.

before running script which has written in notepad you have to enter one command before execution – Set-ExecutionPolicy RemoteSigned

and the output is here!!!

So that’sit I hope you understand how to work with PowerShell ISE and now you are capable for making PowerShell Script.

By Vishal Dhiman

Content crafter, Digital Marketer and also an Ethical Hacker. Love to write technical stuff and sharing knowledge.

2 thoughts on “How to run a script from Powershell. Step by step.”

Leave a Reply

Your email address will not be published. Required fields are marked *