module loading issue

Tagged: 

This topic contains 2 replies, has 2 voices, and was last updated by  John Curtiss 1 week, 5 days ago.

  • Author
    Posts
  • #79132

    John Curtiss
    Participant

    I suspect that when I upgraded my windows 2008 R2 SCOM 2012 R2 servers to powershell 5.1, something happened with psmodulepath. I had some scheduled tasks calling ps scripts, importing the operationsmanager module, and those tasks stopped working.

    this morning when I tested 'ipmo operationsmanager' on any of my three scom servers, I got the "not loaded because no valid module file was found" error.

    the module "operationsmanager.psm1" lives in C:\Program Files\Microsoft System Center 2012 R2\Operations Manager\Powershell\OperationsManager.

    checking $env:psmodulepath showed that path was indeed missing. on my windows 8.1 workstation, which has the scom console installed, that path is present in psmodulepath, and ipmo operationsmanager works.

    on the scom server, if I use the full path to the module, "ipmo 'C:\Program Files\Microsoft System Center 2012 R2\Operations Manager\Powershell\OperationsManager\operationsmanager.psm1'", the module imports without error.

    so I added C:\Program Files\Microsoft System Center 2012 R2\Operations Manager\Powershell\OperationsManager to hklm/...psmodulepath in the registry of the scom server. now $env:psmodulepath now correctly shows the path.

    PS C:\> $env:psmodulepath
    \\sisfpsp4\users\john.curtiss\WindowsPowerShell\Modules;C:\Program Files\WindowsPowerShell\Modules;C:\Windows\syste
    m32\WindowsPowerShell\v1.0\Modules;C:\Program Files\Microsoft System Center 2012 R2\Operations Manager\Powershell\Operat
    ionsManager

    and yet, "ipmo operationsmanager" still throws the "not loaded because no valid module was found" error.

  • #79258

    Don Jones
    Keymaster

    You might try re-installing the SCOM admin tools to let it set the path, and then see what that actually is. I don't have a machine I can try it on; from what you're saying, it seems like what you've done should work, but there's obviously a bit missing.

  • #79460

    John Curtiss
    Participant

    C:\Program Files\Microsoft System Center 2012 R2\Operations Manager\Powershell\OperationsManager

    was the wrong path to put in the module path. powershell wants the module path to be

    C:\Program Files\Microsoft System Center 2012 R2\Operations Manager\Powershell

    but then that path needs to contain a folder with the same name as the module, ie "operationsmanager."

You must be logged in to reply to this topic.