Need help?

Our experts have had an average response time of 11.7 minutes in August 2021 to fix urgent issues.

We will keep your servers stable, secure, and fast at all times for one fixed price.

Powershell to enable script execution – How we do it

by | Feb 12, 2021

Stuck with PowerShell to enable script execution? We can help you.

Usually, users can’t run any scripts by just double-clicking a file. It is a troublesome process.

As a part of our Server Management Services, we assist our customers with script policy queries.

Today, let’s discuss how our Support Engineers do it easily for our customers.

 

A quick look at PowerShell

Windows PowerShell is an object-oriented automation engine and scripting language built on .NET.

In addition, it helps system administrators and power-users to rapidly automate tasks.

.ps1 file is the extension for the PowerShell script. By default, we can’t run a script by just double-clicking a file.

This usually restricts the accidental harm from happening.

During the execution of scripts via PowerShell, it seems like there are some policies that restrict the script execution from happening.

 

Execution Policies during PowerShell script execution

Let us now discuss some major policies. We get one of these outputs during script execution.

Restricted: This message will pop up when we first run any script. This is because Scripts are not allowable here

AllSigned: Here, with this setting, the script will ask for confirmation that we need to run before its execution.

Unrestricted: Here, there are no restrictions present. We can run any scripts that we want.

RemoteSigned: In this case, we can run the scripts that are only signed by a trusted developer.

 

How we enabled Script Execution in Powershell?

Recently, one of our customers approached us with the following error message.

File C:\Common\Scripts\hello.ps1 cannot load because the execution of scripts is disabled on this system. Please see "get-help about_signing" for more details.

Our Support Engineers checked the error and in order to fix it, we went ahead with the below steps:

Initially, we open the PowerShell command prompt with the ‘Administrator’ privilege.

Then we enter the following commands.

  1. Firstly we execute Get-ExecutionPolicy with result as “Restricted”.
  2. Then, to make it unrestricted we execute the “set-execution policy unrestricted” command.
  3. Next, it asked for confirmationDo you want to change the execution policy. By default, it is set to Nand we need to change it to Y”.
  4. Finally, we execute the Get-ExecutionPolicy command so as to check the changed policies. It results in unrestricted privilege.

After doing all these we create a file in notepad and save it with an extension.ps1. For example, myscript.ps1

In the PowerShell, we call the script using the command & “X:\myscript.ps1”

Thus, we enabled the script execution in PowerShell.

Powershell enable script execution

[Couldn’t fix the error?- We’re available 24/7.]

 

Conclusion

In short, we changed PowerShell to enable script execution by running some commands. Today, we discussed how our Support Engineers resolve the script error for our customers.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

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

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF