OperationsManager module cannot be imported because no valid module file was found in any module directory.

Brian W 126 Reputation points
2024-04-24T12:29:25.7633333+00:00

I've checked my PSModule path and "C:\Program Files\Microsoft Monitoring Agent\Agent\PowerShell" is in there, however import-module -name OperationsManager comes back with:

Import-Module : The specified module 'OperationsManager' was not loaded because no valid module file was

found in any module directory.

At line:1 char:1

  • Import-Module -Name OperationsManager
  • 
        + CategoryInfo          : ResourceUnavailable: (OperationsManager:String) [Import-Module], FileNotFoun 
    
       dException
    
        + FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand
    
Microsoft System Center
Microsoft System Center
A suite of Microsoft systems management products that offer solutions for managing datacenter resources, private clouds, and client devices.
1,031 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. XinGuo-MSFT 19,696 Reputation points
    2024-04-25T02:31:17.2066667+00:00

    Hi,

    User's image

    It seems like you’re having trouble importing the OperationsManager module in PowerShell. This error typically occurs when PowerShell can’t find the module in any of the directories specified in the $env:PSModulePath environment variable.

    Here are some steps you can take to troubleshoot this issue:

    1. Verify the module name: Make sure the module name is spelled correctly.
    2. Ensure the correct module path: Check if the module exists in the specified directory. The module needs to be placed in a folder with the same name as the module. For example, if the module name is OperationsManager, the full path would be C:\Program Files\Microsoft Monitoring Agent\Agent\PowerShell\OperationsManager\OperationsManager.psm1.
    3. Check File Extension: Ensure that the module file has the correct .psm1 extension.
    4. Reinstall the SCOM admin tools: If the module is part of the System Center Operations Manager (SCOM) admin tools, you might try reinstalling them.

  2. XinGuo-MSFT 19,696 Reputation points
    2024-05-10T07:07:50.03+00:00

    Ok, I got it.

    Perform the following steps to initiate maintenance mode from the target Windows computer:

    Sign in to the computer.

    Run Windows PowerShell as an administrator from the Start screen.

    Change directory to the following path C:\Program Files\Microsoft Monitoring Agent\Agent by entering cd C:\Program Files\Microsoft Monitoring Agent\Agent.

    Import the module MaintenanceMode.dll by entering Import-module MaintenanceMode.dll.

    Enter Start-SCOMAgentMaintenanceMode and use the parameters to configure the maintenance mode request.

    Start-SCOMAgentMaintenanceMode has the following syntax:

    Start-SCOMAgentMaintenanceMode -Duration <Double (in minutes)> [-Reason <string>] [-Comments <string>]
    

    User's image

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.