How to Enable Execution of PowerShell Scripts

Yoodley is reader-supported. When you buy through links on our site, we may earn an affiliate commission.

Powershell is a robust and strong command shell that can be used to perform and automate multiple system configurations. Since it operates on scripts, known as PowerShell Scripts, enabling it on Windows and other OS is often a task for many users.

In this post, we’ll discuss how you can enable PowerShell Scripts on Windows, all while giving you meaningful insights into myriad things associated with PowerShell, its scripts, and its commands. 

What are PowerShell Scripts?

PowerShell is a cross-platform command shell that is generally used to automate tasks and manage configuration in systems. It was released on 14 November 2006 as a successor to the traditional Command Prompt found in Windows OS. However, it was so much more powerful than Command Prompt that it was treated as a separate entity, and today, both Command Prompt and Powershell exist in Windows.

Powershell Scripts is a programming language that is used to automate routine system management and the building, testing, and deployment of solutions in CI/CD environments.

The PowerShell Scripting language also includes features found in other programming languages such as functions, classes, scripts, and modules. It also has built-in support for common data formats like CSV, JSON, and XML

How to enable PowerShell scripts on Windows?

To enable Powershell on Windows 10 and Windows 7, follow these steps:

  • Press the Start button
  • Type Windows Powershell in the search bar 
  • Right-click on the app and select Run as Administrator (If you receive a user account control prompt, left-click on Yes)
  • Once open, type Set-ExecutionPolicy Unrestricted in the shell and press <Enter>. If you get a prompt asking to confirm, type A and press <Enter>


Can you enable PowerShell Scripts on Linux and MacOS?

Surprisingly enough, Windows Powershell is available to be used on MacOS and Linux in Microsoft’s bid to make Powershell a cross-platform tool.

How to enable PowerShell scripts on Linux?

Powershell can be used on Ubuntu, following these steps:

First, navigate to the /tmp directory with the following command:

$ cd /tmp

Now, download the Microsoft package repository installer DEB package file with the following command:

$ wget -q

Now, install the Microsoft package repository installer DEB package with the following command:

$ sudo apt-get install ./packages-Microsoft-prod.deb

This should have enabled the Microsoft package repositories.

Now, you need to update the APT package repository cache by using the command given below:

$ sudo apt update

As soon as the command is executed, the APT package repository cache gets updated. We’ll use the Microsoft package repository, which is listed here.

By following the command given below, users can easily install PowerShell on their Ubuntu 18.04 LTS machine.

$ sudo apt install powershell

Press y and then press <Enter>, it will confirm the installation, and now PowerShell is installed successfully.

Once PowerShell is installed successfully, you can check by the following command that it is working properly or not:

$ pwsh --version

The PowerShell version info is found printed on the console.

How to enable PowerShell Scripts on MacOS?

For the installation of PowerShell 7.0 or higher, macOS 10.13 and higher are required. For macOS, packages visit the GitHub releases page, where you will get the PowerShell macOS package.

Homebrew is a preferred package manager for macOs and, we’ll also use the same Homebrew installation method and the command given below to make the installation process easy.

/bin/bash -c "$(curl -fsSL"

Upon installing Homebrew, use the following brew command to install PowerShell on macOS:

brew install --cask powershell

The installation looks like this:

==> Downloading

==> Downloading from

######################################################################## 100.0%

==> Installing Cask powershell

==> Running the installer for powershell

==> Package installers may write to any location


installer: Package name is PowerShell - 7.1.0

installer: Installing at base path /

installer: Installation successful.


How to solve the ‘enable scripts’ error on PowerShell?

The ‘enable scripts’ error occurs when ExecutionPolicy is restricted. To solve this, you need to first use the “Run as Administrator” option to start PowerShell on Windows. Then enter “Set-ExecutionPolicy Remotesigned,” which will enable running unsigned scripts.

Now you can run the unsigned scripts freely from your local computer or the signed scripts from the internet.


Can Powershell run bash Scripts?

Yes, a user can create and run Bash shell scripts on Windows 10, and the user can incorporate Bash commands either in a Windows batch file or PowerShell script.

Here’s the catch, however: Windows and UNIX are quite different from each other, and the Windows file system in a Bash environment is accessible from different locations.

While writing a shell script, one needs to keep in mind that Windows, UNIX, and Linux, use different “end of line” characters in text files in shell scripts.

This means that a shell script can’t be written in a Notepad because it will not be interpreted properly by Bash. But in place of Notepad, users can opt to advance text editors like Notepad++, which can give a file UNIX end-of-line characters.

Here is how you can run the script from the terminal itself:

  • Open Powershell Terminal 
  • Type the following command to run the script and press <Enter>:

& "C:\PATH\TO\SCRIPT\first_script.ps1"

In the above command, make sure to change “PATH\TO\SCRIPT” to the location of your script.


What is a PowerShell Cmdlet?

Used in Window’s base PowerShell environment, the cmdlet is a lightweight and robust command that is invoked in the PowerShell command prompt. Creating and invoking these Command lets or cmdlets can be done with PowerShell APIS.


Is Windows PowerShell the same as Command Prompt?

Windows Powershell was originally created as a replacement for the classic Command Prompt, but to say that the Powershell is just an updated form of it will be inaccurate. The fact that both programs still exist on Windows 10 is enough proof that Powershell has outgrown its intended functionality and morphed into something more than a simple command-line interpreter.

However, Command Prompt is still very popular as it is very easy to use and uses classic DOS commands, which is enough for many. But for users that want full control over a network, Powershell is the way to go as it provides them with cmdlets that can reach into registry management and WMI. 

What are the differences between Cmdlet and Command?

Cmdlet is a command used in the PowerShell environment. The collection of cmdlets (known as modules) are stored in the following file path: %WINDIR%\System32\WindowsPowerShell\.

Command or cmd is a directive to a specific program for performing certain tasks. Either issued via shell or as a part of the network protocol, or an interface in a GUI, Command or cmd is the default command-line interpreter for multiple OS such as Windows and ReactOS.

Cmdlets are different from commands such as:

  • Cmdlets being a .NET Framework class object, are not executed separately.
  • Cmdlets are usually constructed by 12 lines of code.
  • Cmdlets are unable to handle parsing, output formatting, and error presentation.
  • Cmdlets can process a single object at a time because it is record-based.
  • Cmdlets process works on objects. Therefore, text streams and objects can’t be passed as the output of pipelining.


Read More

  1. What is DiagTrack?
  2. How to Transfer Files From PC to PC Using Wifi (Without Internet)


Please enter your comment!
Please enter your name here