This topic contains 2 replies, has 2 voices, and was last updated by
September 8, 2017 at 3:03 pm #79132ParticipantPoints: 0Rank: Member
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
m32\WindowsPowerShell\v1.0\Modules;C:\Program Files\Microsoft System Center 2012 R2\Operations Manager\Powershell\Operat
and yet, "ipmo operationsmanager" still throws the "not loaded because no valid module was found" error.
September 11, 2017 at 1:39 pm #79258KeymasterPoints: 1,524Rank: Community Hero
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.
September 13, 2017 at 1:04 am #79460ParticipantPoints: 0Rank: Member
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."
The topic ‘module loading issue’ is closed to new replies.