PS Script doesnt imports Module from PSModulePath

AW07 25 Reputation points
2023-10-11T03:25:06.04+00:00

Hello Guyz,

I want to Import the Modules from PSModulePath.
Specifically :- C:\Program Files\WindowsPowerShell\Modules

C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules

I have Module Installed on the Above Path.

Module Name :- ExchangeOnlineManagement

When we run PS Script it doesnt import the Module from PSModulePath.
Get-Module -ListAvailable.
It doesnt loads the Module from the Above Path.

But when we rdp with same Credentials and try Import-Module Command from Powershell App it successfully imports All the Module.

Get-Module -ListAvailable.
It Successfully Loads the Module from PSModulePath.

I've checked the PSModulePath and Permissions. I Checked the Folder Permissions.
I'm using Windows Powershell 5.1 .

Set-ExecutionPolicy is also set to bypass.
I've Tried Importing ExchangeOnlineManagement by using its Path. But same its imports when rdp and doesnt from PS Script.

Thanks for the help in Advance!!!

Microsoft Exchange Online Management
Microsoft Exchange Online Management
Microsoft Exchange Online: A Microsoft email and calendaring hosted service.Management: The act or process of organizing, handling, directing or controlling something.
4,253 questions
Exchange Server Management
Exchange Server Management
Exchange Server: A family of Microsoft client/server messaging and collaboration software.Management: The act or process of organizing, handling, directing or controlling something.
7,396 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,408 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,163 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Aholic Liang-MSFT 13,826 Reputation points Microsoft Vendor
    2023-10-11T08:12:00.81+00:00

    Hi @ AW07,

    Please run this command to check if the module is installed on the server:

    Get-InstalledModule ExchangeOnlineManagement | Format-List Name,Version,InstalledLocation
    

    If not, you can refer to this document to install the Exchange Online Management module:

    About the Exchange Online PowerShell V3 module | Microsoft Learn


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  2. Rich Matheisen 45,111 Reputation points
    2023-10-11T15:10:56.9533333+00:00

    What are the paths found if you run this? $env:PSModulePath -split ';'

    Do that when your RDP'd into the server and from the other server.

    BTW, what does "triggered" mean? How does the "another server" accomplish that action?

    0 comments No comments