DetailPage-MSS-KB

Microsoft small business knowledge base

Article ID: 2411920 - Last Review: December 12, 2014 - Revision: 27.0

PROBLEM

When you try to run a script in Microsoft Azure Active Directory Module for Windows PowerShell, you receive one of the following error messages:
File C:\my_script.ps1 cannot be loaded. The execution of scripts is disabled on this system. Please see "Get-Help about_signing" for more details.
File C:\Desktop\myscript.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at http://go.microsoft.com/fwlink/?LinkID=135170.
File C:\my_script.ps1 cannot be loaded. The file C:\my_script.ps1 is not digitally signed. The script will not execute on the system. For more information, see about_Execution_Policies at http://go.microsoft.com/fwlink/?LinkID=135170.

CAUSE

This issue may occur if the execution policy is set to Restricted. Certain Windows PowerShell cmdlets can't run if the policy is too restricted.

SOLUTION

To resolve this issue, follow these steps:
  1. Run the Azure Active Directory Module for Windows PowerShell as an admin. To do this, click Start, click All Programs, click Windows Azure Active Directory, right-click Windows Azure Active Directory Module for Windows PowerShell, and then click Run as administrator.
  2. Set the execution policy to Unrestricted. To do this, type the following cmdlet, and then press Enter:
    Set-ExecutionPolicy Unrestricted
  3. Run the Windows PowerShell cmdlets that you want.
  4. Set the execution policy to Restricted. To do this, type the following cmdlet, and then press Enter:
    Set-ExecutionPolicy Restricted

MORE INFORMATION

To help deliver a more secure command-line administration experience, Windows PowerShell uses "execution policies" to control how Windows PowerShell can be used. Execution policies define the restrictions under which Windows PowerShell loads files for execution and configuration. By default, Windows PowerShell runs in the Restricted execution policy. This mode is its most secure mode in which Windows PowerShell operates as an interactive shell only.

The four execution policies are as follows:
  • Restricted is the default execution policy. This policy doesn't run scripts and is interactive only.
  • AllSigned policy runs scripts. All scripts and configuration files must be signed by a publisher that you trust. This policy opens you to the risk of running signed but malicious scripts, after you confirm that you trust the publisher.
  • RemoteSigned policy runs scripts. All scripts and configuration files that are downloaded from communication applications such as Microsoft Outlook, Windows Internet Explorer, Outlook Express, and Windows Messenger must be signed by a publisher that you trust. This policy opens you to the risk of running malicious scripts that are not downloaded from these applications, and you are not prompted.
  • Unrestricted policy runs scripts. All scripts and configuration files that are downloaded from communication applications such as Outlook, Internet Explorer, Outlook Express, and Windows Messenger run after you confirm that you understand that the file originated from the Internet. No digital signature is required. This policy opens you to the risk of running unsigned, malicious scripts that are downloaded from these applications.

Still need help? Go to the Office 365 Community (http://community.office365.com/) website or the Azure Active Directory Forums (https://social.msdn.microsoft.com/forums/azure/en-US/home?forum=WindowsAzureAD) website.

Applies to
  • Microsoft Azure Active Directory
  • Microsoft Office 365
  • Microsoft Intune
  • CRM Online via Office 365 E Plans
  • Microsoft Azure Recovery Services
  • Office 365 User and Domain Management
  • Office 365 Identity Management
Keywords: 
o365 o365a o365e o365m o365p o365022013 KB2411920
Share
Additional support options
Ask The Microsoft Small Business Support Community
Contact Microsoft Small Business Support
Find Microsoft Small Business Support Certified Partner
Find a Microsoft Store For In-Person Small Business Support