Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get-InstalledModule returns no results when MyDocuments is in the OneDrive folder. #509

Open
aetos382 opened this issue Jul 4, 2019 · 3 comments

Comments

Projects
None yet
3 participants
@aetos382
Copy link

commented Jul 4, 2019

Steps to reproduce

Configure the OneDrive client to back up the Document directory containing your PowerShell directory to OneDrive.

Get-InstalledModule

Expected behavior

Version              Name                                Repository           Description
-------              ----                                ----------           -----------
1.4.2                PackageManagement                   PSGallery            PackageManagement (a.k.a. OneGet) ...
2.1.5                PowerShellGet                       PSGallery            PowerShell module with commands f ...

Actual behavior

(No results)

Environment data

> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      6.2.1
PSEdition                      Core
GitCommitId                    6.2.1
OS                             Microsoft Windows 10.0.18932
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
> Get-Module -ListAvailable PowerShellGet,PackageManagement


    Directory: C:\Users\aetos\OneDrive\ドキュメント\PowerShell\Modules

ModuleType Version    Name                                PSEdition ExportedCommands
---------- -------    ----                                --------- ----------------
Script     1.4.2      PackageManagement                   Desk      {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource…}
Script     2.1.5      PowerShellGet                       Desk      {Find-Command, Find-DSCResource, Find-Module, Find-RoleCapability…}

    Directory: C:\program files\powershell\6\Modules

ModuleType Version    Name                                PSEdition ExportedCommands
---------- -------    ----                                --------- ----------------
Script     1.3.2      PackageManagement                   Desk      {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource…}
Script     2.1.3      PowerShellGet                       Desk      {Find-Command, Find-DSCResource, Find-Module, Find-RoleCapability…}
> Get-PackageProvider -ListAvailable
Name                     Version          DynamicOptions
----                     -------          --------------
NuGet                    3.0.0.1          Destination, ExcludeVersion, Scope, SkipDependencies, Headers, FilterOnTag, Contains, AllowPrereleaseVersions, ConfigFile, SkipValidate
PowerShellGet            2.1.5.0          PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, InstallUpdate, NoPathUpdate, AllowPrereleaseVersions, Filter, Tag, Includes, DscResource, RoleCapability, Command, Acce…
PowerShellGet            2.1.3.0

OneDrive version 2019 (19.086.0502.0006)

Cause of problem

Directories in OneDrive are reparse point.
Get-InstalledModule command uses Get-ChildItem command to search for PSGetModuleInfo.xml, but can not search within the reparse point because the FollowSymLink parameter is not set.

# find all modules installed using PowerShellGet
$GetChildItemParams = @{
Path = $location
Recurse = $true
Force = $true
Filter = $script:PSGetItemInfoFileName
ErrorAction = 'SilentlyContinue'
WarningAction = 'SilentlyContinue'
}
if($script:IsWindows)
{
$GetChildItemParams['Attributes'] = 'Hidden'
}
$moduleBases = Get-ChildItem @GetChildItemParams | Foreach-Object { $_.Directory }

@aetos382

This comment has been minimized.

Copy link
Author

commented Jul 7, 2019

Currently, Windows 10 recommends placing the Documents folder on OneDrive during its setup.
Therefore, the possibility of this problem occurring is very high.

@SydneyhSmith

This comment has been minimized.

Copy link
Collaborator

commented Jul 8, 2019

@aetos382 thanks for reporting this issue--this is likely a result of Get-InstalledModule only looking for modules which were installed using PowerShellGet and therefore only checking those default installation paths...we should address how to make this more configurable especially with so many users saving to onedrive

@kilasuit

This comment has been minimized.

Copy link

commented Jul 9, 2019

I have some weird results from this (though my machine probs needs a rebuild anyway)

5.1 - shows up all ok for OneDrive location
6.2 - nothing shows for OneDrive
7.0 - some modules show from the OneDrive Location, some don't

I think there's been many changes to how v6+ actually works out PSModulePath as per this list of PR's https://github.com/PowerShell/PowerShell/pulls?q=is%3Apr+PSModulePath+is%3Aclosed

Whether this is a PowerShell or PowerShellGet issue I am not sure but I think I may need to just spin up a test VM to see if the results are any different

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.