Learning and Sharing
  • Home
  • Blog
  • Linux
  • macOS
  • Virtualization
    • VMware
    • VirtualBox
  • Windows
    • Windows 11
    • Windows 10
    • Windows Server
  • Series
    • Symantec
    • Intune
    • Microsoft Azure
    • Powershell
    • VirtualBox
    • VMware
    • PowerShell Learning
    • Microsoft Graph
  • More
    • Auto Installation
    • AEC Installation
  • Contact
No Result
View All Result
  • Home
  • Blog
  • Linux
  • macOS
  • Virtualization
    • VMware
    • VirtualBox
  • Windows
    • Windows 11
    • Windows 10
    • Windows Server
  • Series
    • Symantec
    • Intune
    • Microsoft Azure
    • Powershell
    • VirtualBox
    • VMware
    • PowerShell Learning
    • Microsoft Graph
  • More
    • Auto Installation
    • AEC Installation
  • Contact
No Result
View All Result
No Result
View All Result

The File is not Digitally Signed You Cannot Run this Script on the Current System

August 31, 2023
in Blog, Powershell
0
ADVERTISEMENT

Table of Contents

The File is not Digitally Signed

In some cases, you would get the following error when trying to run a PowerShell script downloaded from the internet. In our case, this script to get reporting about mailboxes.

D:\scripts\.\MailboxSizeReport365.ps1
jRUB5STRA1hxDH0v5YX0HrjXkOFo8UmN0pJZrKb6o4afNZCtcGuUcmcZNtmr

PS C:\> D:\scripts\MailboxSizeReport365.ps1
D:\scripts\MailboxSizeReport365.ps1 : File D:\scripts\MailboxSizeReport365.ps1 cannot be loaded. The file
D:\scripts\MailboxSizeReport365.ps1 is not digitally signed. You cannot run this script on the current system. For more information about running scripts and setting execution policy, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ D:\scripts\MailboxSizeReport365.ps1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess

When we check the execution policy in our computer. It said the current policy is configured to RemoteSigned. It means the computer is allowed to run scripts that have been create on this computer or be signed.

PS C:\> Get-ExecutionPolicy
RemoteSigned

Solutions

Method 1: Unblock the file downloaded from internet

The first and easiest way to run this script is unblock this file. When a script downloaded from the internet, Windows blocked the files to protect your computer.

You can check it by right-clicking on the file then selecting Properties. As you can see in the below screenshot, the file has been blocked. You can select the unblock checkbox then click OK to unblock it.

W0lzg7lawlYLm2zDz8hvYo5BzaWgarnX5ccws66qmRiPQsJ5pgY3AcnZKyU8

Once the file is unblocked, the script should be running without any issues.

JhdGSst4Y5QYn4YVUlmg8kPpBQdh7svMnHP5Hyi9y6gy8kDEentH9WMmejcN

Alternatively, you can unblock the file using Unblock-File cmdlet as follows:

Unblobk-File -Path 'D:\scripts\MailboxSizeReport365.ps1'

Method 2: Change the execution policy

The second way, you can change the execution policy on your computer. We use the Bypass policy with Process parameter. This allows your computer to run any scripts in the current session only.

Set-ExecutionPolicy -ExecutionPolicy Bypass Process

As you can see, even the file still blocking, the script can be run without any errors.

PS C:\> Set-ExecutionPolicy -ExecutionPolicy Bypass Process
PS C:\> Get-ExecutionPolicy
Bypass
PS C:\> D:\scripts\.\MailboxSizeReport365.ps1

Mailbox Size Report 365
----------------------------
1.Export to CSV File (OFFICE 365)
2.Enter the Mailbox Name with Wild Card (Export) (OFFICE 365)
Choose The Task:

If you close, then reopen a new PowerShell window. The execution policy would be reverted to RemoteSigned.

fuuT3vShklNTjAVRNRTIMpUOghagDWTbrCBJEJVpk4cpzEn67qqTWiX7E3GA

Additionally, you can run the below command to allow running any scripts in your computer permanently.

Note Note: We don't recommend use this method because it will expose many security risks if you're not working in a safety environment. So, do it with your own risk.
Set-ExecutionPolicy -ExecutionPolicy Unrestricted

When using Unrestricted policy, unsigned scripts can run. There is a risk of running malicious scripts. PowerShell will warn you before running scripts and configuration files that are not from the local intranet zone.

PS C:\> D:\scripts\.\MailboxSizeReport365.ps1

Security warning
Run only scripts that you trust. While scripts from the internet can be useful, this script can potentially harm your
computer. If you trust this script, use the Unblock-File cmdlet to allow the script to run without this warning
message. Do you want to run D:\scripts\MailboxSizeReport365.ps1?
[D] Do not run  [R] Run once  [S] Suspend  [?] Help (default is "D"): r

Mailbox Size Report 365
----------------------------
1.Export to CSV File (OFFICE 365)
2.Enter the Mailbox Name with Wild Card (Export) (OFFICE 365)
Choose The Task:

Read More: Describes the PowerShell execution policies and explains how to manage them.

Not a reader? Watch this related video tutorial:

5/5 - (1 vote)
Previous Post

The Differences Between App Registration vs Enterprise App in Entra ID

Next Post

How to Configure the PowerShell Execution Policy on Windows

Related Posts

Running Hyper-V and VMware Workstation on The Same Machine

August 15, 2024

How to Uninstall All Autodesk Products At Once Silently

July 29, 2024
Ftr5

How to Uninstall the Autodesk Genuine Service on Windows

July 29, 2024
Ftr19

How to Fix Windows Cannot Read the ProductKey From the Unattend Answer File in VirtualBox

July 26, 2024
Ftr25

How to Update Windows Terminal in Windows 10/11

July 26, 2024

How to Disable The Beep Sound in WSL Terminal on Windows

July 26, 2024

Leave a Reply Cancel reply

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

Recent Posts

  • How To Turn On uBlock Origin Extension in Chrome (2025)
  • Images Hidden Due To Mature Content Settings In CivitAI
  • Azure OpenAI vs Azure AI Hub, How to Choose the Right One for Your Needs

Categories

Stay in Touch

Discord Server

Join the Discord server with the site members for all questions and discussions.

Telegram Community

Jump in Telegram server. Ask questions and discuss everything with the site members.

Youtube Channel

Watch more videos, learning and sharing with Leo ❤❤❤. Sharing to be better.

Newsletter

Join the movement and receive our weekly Tech related newsletter. It’s Free.

General

Microsoft Windows

Microsoft Office

VMware

VirtualBox

Technology

PowerShell

Microsoft 365

Microsoft Teams

Email Servers

Copyright 2025 © All rights Reserved. Design by Leo with ❤

No Result
View All Result
  • Home
  • Linux
  • Intune
  • macOS
  • VMware
  • VirtualBox
  • Powershell
  • Windows 10
  • Windows 11
  • Microsoft 365
  • Microsoft Azure
  • Microsoft Office
  • Active Directory

No Result
View All Result
  • Home
  • Linux
  • Intune
  • macOS
  • VMware
  • VirtualBox
  • Powershell
  • Windows 10
  • Windows 11
  • Microsoft 365
  • Microsoft Azure
  • Microsoft Office
  • Active Directory