Power shell: Import-Module
Asked Answered
A

2

9

I have been trying to us the app fabric caching on a win2008 standard server. When I execute the follwowing command I get: Import-Module DistributedCacheAdministration Import-Module : The specified module 'DistributedCacheAdministration' was not loaded because no valid module file was found in any module directory.

Where is this directory located and how can I use that module

Also, it appears that I have powershell 1. I cant seem to install powershell 2

Atropine answered 11/4, 2011 at 14:26 Comment(0)
W
13

Modules and their commands is a feature in Powershell 2 only, so you can be quite certain you're running this version. I guess you're confused because the Powershell.exe is located in a "1.0" directory; that's only to make version 2.0 backwards compatible.

You need to specify the exact location of the module to load: Import-Module [-Force] path-to-module-file`

Even better is have it available via the $PSModulePath environment variable. Try a Get-Module -ListAvailable to see what modules are available. Since the one you're trying to load does not seem to be listed, try setting the $PSModulePath to the folder above the directory holding the module file.

When you're satisfied with having the correct module path, set it via Computer Properties.

World answered 11/4, 2011 at 15:11 Comment(3)
@Joey. thanks. Yes. I thought I had version 1 b/c of the path. and thought that is why didn't have the didnt have DistributedCacheAdministration module. I still cant find that moduleAtropine
I tried "Get-Module -ListAvailable" on a straight-from-the-box (or, rather straight-from-the-HyperV-terminal ;)) Win2008 Server, and the module isn't listed. Are you sure MS is the module distributor?Incandescent
I upvoted because it got me closer to a potential answer, but when I did Import-Module -Force it says... Import-Module : The specified module 'C:\Windows\System32\WindowsPowerShell\v1.0\Modules\DistributedCacheAdministration\' was not loaded because no valid module file was found in any module directory.At line:1 char:1Born
T
0

I installed AppFabric and the folder shows up at C:\Windows\System32\WindowsPowerShell\v1.0\Modules\DistributedCacheAdministration

Yet Import-Module DistributedCacheAdministration doesn't work and the module isn't listed in Get-Module -ListAvailable

Throwaway answered 7/8, 2013 at 8:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.