After Installing VMware PowerCLI, Commands will fail with the error: "Module could not be loaded on PowerShell because running scripts is disabled on this system"
search cancel

After Installing VMware PowerCLI, Commands will fail with the error: "Module could not be loaded on PowerShell because running scripts is disabled on this system"

book

Article ID: 389481

calendar_today

Updated On: 02-28-2025

Products

VMware

Issue/Introduction

Environment

VMware PowerCLI 13.3

Resolution

The PowerShell execution policy is restricting scripts from running on your system, which is preventing the module from being loaded. To resolve this, you'll need to change the execution policy to allow scripts to run.

 

To Check Current Execution Policy:

Run this command to see the current execution policy: #  Get-ExecutionPolicy

If it returns something like "Restricted", you'll need to change it.

 

To Change the Current Execution Policy:

 Run the command : # Set-ExecutionPolicy -ExecutionPolicy AllSigned

You can also use the Set-ExecutionPolicy RemoteSigned command which will apply to all PowerShell sessions on your system unless you specify a scope. By default, the change applies globally (to all users), but you can limit the scope of the change if you want it to apply only to the current session or just for the current user. 

 

To apply it globally (default):

# Set-ExecutionPolicy RemoteSigned

This affects all users on the system and all PowerShell sessions.

 

To apply it only to the current session:

 
# Set-ExecutionPolicy RemoteSigned -Scope Process

This change will last only for the current PowerShell session and will be reset when you close PowerShell.

 

To apply it only for the current user:

 
# Set-ExecutionPolicy RemoteSigned -Scope CurrentUser

This will allow scripts to run only for the current user and will persist across sessions but not affect other users on the system.

If you want the change to be permanent and apply to all future sessions, you don’t need to specify a scope—just using Set-ExecutionPolicy RemoteSigned will work.

 

Additional Information

Reference Document: PowerShell Execution Policy