Jump-Location icon indicating copy to clipboard operation
Jump-Location copied to clipboard

Support for PS v2

Open skalinkin opened this issue 11 years ago • 15 comments

unziped => unlocked => installed => after run PS got that: Import-Module : The 'C:\Users\ME\Documents\Jump-Location-0.5.1\Jump.Location.psd1' module cannot be imported because its manifest contains one or more members that are not valid. The valid manifest members are ('ModuleToProcess', 'NestedModules', 'GUID', 'Author', 'CompanyName', 'Copyright', 'ModuleVersion', 'Description', 'PowerShellVersion', 'PowerShellHostName', 'PowerShellHostVersion', 'CLRVersion', 'DotNetFrameworkVersion', 'ProcessorArchitecture', 'RequiredModules', 'TypesToProcess', 'FormatsToProcess', 'ScriptsToProcess', 'PrivateData', 'RequiredAssemblies', 'ModuleList', 'FileList', 'FunctionsToExport', 'VariablesToExport', 'AliasesToExport', 'CmdletsToExport'). Remove the members that arenot valid ('RootModule'), then try to import the module again. At C:\Users\ME\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1:2 char:14

  • Import-Module <<<< 'C:\Users\ME\Documents\Jump-Location-0.5.1\Jump.Location.psd1'
    • CategoryInfo : InvalidData: (C:\Users\ME...p.Location.psd1:String) [Import-Module], InvalidOperatio nException
    • FullyQualifiedErrorId : Modules_InvalidManifestMember,Microsoft.PowerShell.Commands.ImportModuleCommand

skalinkin avatar Sep 19 '14 13:09 skalinkin

So you're using PowerShell V2, right? RootModule was added in V3 I think.

lzybkr avatar Sep 19 '14 15:09 lzybkr

Can someone verify that RootModule was added in V3? If so, let's update the documentation to be clear that we only support V3+ and close this issue.

tkellogg avatar Sep 19 '14 19:09 tkellogg

Yes I was running powershell V2 on Windows 7 and received the same error. I then updated to V3 and now it runs perfectly.

bpugh avatar Sep 19 '14 19:09 bpugh

Ok, I updated the readme to include the the dependency on V3+. It would be great if the dependency could be checked automatically but I'm closing this issue for now since it's now documented.

tkellogg avatar Sep 19 '14 19:09 tkellogg

Actually found the documentation for it here: http://technet.microsoft.com/library/hh849709.aspx And under RootModule it says: Note: In Windows PowerShell 2.0, this key was called "ModuleToProcess." You can use the "RootModule" parameter name or its "ModuleToProcess" alias.

So it looks like you could support V2 if you wanted by using the `ModuleToProcess' alias

bpugh avatar Sep 19 '14 19:09 bpugh

@bpugh Do you want to take a whack at this? I unfortunately don't have access to the Microsoft dev tools at the moment, so I'm reduced to groveling for people to contribute code.

tkellogg avatar Sep 19 '14 19:09 tkellogg

Should be easy. I renamed and reopen issue.

vors avatar Sep 19 '14 19:09 vors

Sure no problem! Alternatively you could actually enforce the version by setting PowerShellVersion = '3.0' in the same file.

bpugh avatar Sep 19 '14 19:09 bpugh

I think support for v2 would be nice - even if v3 or higher is installed, many of us must venture into v2 land (with the -version 2 switch) for dealing with sharepoint and exchange.

oising avatar Sep 23 '14 20:09 oising

So after messing around with this for a bit I seem to be stuck on an odd error. I made the change I described above which is changing RootModule to ModuleToProcess but when I load my profile in PS v2 I get the following error:

[Jump-location] Database contains 1 records.

Import-Module : The module to process 'Load.ps1', listed in field 'ModuleToProcess' of module manifest 'C:\projects\jump-location\Jump.Location.psd1' 
was not processed because no valid module was found in any module directory.
At C:\Users\Brandon\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1:8 char:14
+ Import-Module <<<<  'C:\projects\jump-location\Jump.Location.psd1'
    + CategoryInfo          : ResourceUnavailable: (Jump.Location:String) [Import-Module], FileNotFoundException
    + FullyQualifiedErrorId : Modules_ModuleFileNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand

The odd thing is as you can see jump-location still starts up just fine and work just fine after that even though the error complains about not being able to find the file. I haven't been able to find a solution anywhere online. Any thoughts?

bpugh avatar Sep 23 '14 23:09 bpugh

@bpugh I saw same thing, but didn't have time to investigate.

vors avatar Sep 23 '14 23:09 vors

Turns out it was just a matter of renaming the file. Apparently v2 is a stickler about modules having the proper .psm1 file extension.

bpugh avatar Sep 24 '14 06:09 bpugh

Nice work! Let me test it

vors avatar Sep 24 '14 07:09 vors

@vors Did you get a chance to test this and #34 ?

dragon788 avatar Jun 23 '16 15:06 dragon788

@dragon788 I think both me and @tkellogg cannot allocate time to work on Jump-Location anymore. @tkellogg maybe do a call for maintainers?

vors avatar Jun 23 '16 20:06 vors