[PS 2.0 PSCX 2.2.1] Cannot install module

Topics: User Forum
Jan 27, 2013 at 4:54 PM
Edited Jan 27, 2013 at 5:00 PM


I tried to install (in safe mode and normal mode) PSCX, i deziped the folder, renamed it to Pscx, and improted it with the command found in Pscx's files

I copied the Pscx's folder in C:\Windows\System32\WindowsPowerShell\v1.0\Modules before trying to import it.

I checked rights, and Administrators group do have rights to read/write from there

I don't understand what i did wrong...




Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. All rights reserved.

PS C:\Users\Trololo> Import-Module Pscx -arg "$(Split-Path $profile -parent)\Pscx.UserPreferences.ps1"
Import-Module : The specified module 'Pscx' was not loaded because no valid module file was found in any module directory.
At line:1 char:14
+ Import-Module <<<<  Pscx -arg "$(Split-Path $profile -parent)\Pscx.UserPreferences.ps1"
    + CategoryInfo          : ResourceUnavailable: (Pscx:String) [Import-Module], FileNotFoundException
    + FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand

PS C:\Users\Trololo> $host

Name             : ConsoleHost
Version          : 2.0
InstanceId       : 971fca6e-6028-44dd-b460-5b14c681ce8c
UI               : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture   : ru-RU
CurrentUICulture : en-US
PrivateData      : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
IsRunspacePushed : False
Runspace         : System.Management.Automation.Runspaces.LocalRunspace

PS C:\Users\Trololo>
Jan 31, 2013 at 6:19 PM
Edited Jan 31, 2013 at 6:20 PM
32-bit (x86) PowerShell will not find PSCX in that location. Are you trying to import the module from a 32-bit PowerShell console?
Feb 1, 2013 at 9:21 AM
I have the exact same problem ... I followed the directions in the ReleaseNotes.txt, copied Pscx-2.1.1 directory into "C:\Windows\System32\WindowsPowerShell\v1.0\Modules" but when I tried to import, the PSCX module could not be found. In my case, I have a 32-bit Win7 OS so 32-bit PowerShell.

Also, it was not clear to me if I should copy the folder Pscx-2.1.1 into the Modules directory or the contents of the folder but I tried both and neither of them worked.

Thanks for helping us out!
Feb 2, 2013 at 6:50 AM
In order for Import-Module PSCX to find PSCX, you need the file PSCX.psd1 to be in a folder named PSCX ... and that folder should be directly in one of the folders that is listed in your PSModulePath.

C:\Windows\System32\WindowsPowerShell\v1.0\Modules is one of the folders that is in your PSModulePath by default, so that should work. If you've installed it there properly, you should be able to find: C:\Windows\System32\WindowsPowerShell\v1.0\Modules\PSCX\PSCX.psd1 and it should show up if you run this in your PowerShell instance:

$Env:PSModulePath -split ";" | %{ join-path $_ "PSCX\PSCX.psm1"} | ls

You should get an error or two, but it should find the file in one of the locations it checks.
If it doesn't show up, then you have the module in the wrong place (and the error(s) that show up should tell you the places you can try).
Feb 3, 2013 at 6:21 AM
Thank you, Jaykul, for a detailed explanation. Very helpful!

Yep, renaming the folder (from Pscx-2.1.1 to Pscx) did the trick! That, plus changing the execution policy from Restricted to RemoteSigned :-)

I look forward to using PSCX and maybe one day contributing to it.
Feb 16, 2013 at 6:12 PM
FYI, I have uploaded a new Pscx-2.1.1.zip file where the contained folder is named just Pscx (not Pscx-2.1.1). That should help avoid this problem in the future - I hope.