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

Module not loading #8

Open
dennisa72295 opened this issue Mar 27, 2024 · 7 comments
Open

Module not loading #8

dennisa72295 opened this issue Mar 27, 2024 · 7 comments

Comments

@dennisa72295
Copy link

Due to security policies I can't use Install-module to install dbatools nor dbatools.library. I downloaded the latest release of both and unzipped them into My Documents\WindowsPowershell\Modules directory. I removed the -master and -main from the folder names.
When I try to import the module dbatools I get and error from the dbatools.library module:

import-module : The specified module 'C:\Users\adm-l2a-deanderson\Documents\WindowsPowerShell\Modules\dbatools.library
desktop\lib\Microsoft.Data.SqlClient.dll' was not loaded because no valid module file was found in any module
directory.
At line:1 char:1

  • import-module dbatools
  •   + CategoryInfo          : ResourceUnavailable: (C:\Users\adm-l2...a.SqlClient.dll:String) [Import-Module], FileNot
     FoundException
      + FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand
    
@dennisa72295
Copy link
Author

The directory structure between the older version and the latest release of dbatool.library is totally different. The older version I only see a folder named 2023.5.5 under the main folder, while the new version has several folders and files listed

@jpomfret
Copy link

jpomfret commented Apr 2, 2024

Hi @dennisa72295 - when you download and unzip make sure you match the directory structure in My Documents\WindowsPowershell\Modules

I would expect

  • folder for the module - e.g. ...My Documents\WindowsPowershell\Modules\dbatools.library
  • folder for the version - e.g. ...My Documents\WindowsPowershell\Modules\dbatools.library\2023.9.21
  • module files in that folder - e.g. ...My Documents\WindowsPowershell\Modules\dbatools.library\2023.9.21\dbatools.library.psd1

also when you download from the internet sometimes the files are blocked - you can unblock them all like this:

Get-ChildItem -Path '...My Documents\WindowsPowershell\Modules\dbatools.library\2023.9.21' -Recurse | Unblock-File 

Which is the equivalent of checking this checkbox
image

@dennisa72295
Copy link
Author

The downloadable zip file for the dbatools.library doesn't have the same directory structure. Meaning that in the previous version when I unzipped it there was a 2023.9.21 folder, however, in the latest version there is no such folder (2024.3.9) in the zip file. The only way I could get a correct module installed was to go to a personal off network PC and install from the internet then copy the installed directories to USB and sneakernet them over to my on network PC. This makes any future upgrades a lot harder to do.

@jpomfret
Copy link

jpomfret commented Apr 2, 2024

Where do you download the zip from? PowerShell Gallery?

@dennisa72295
Copy link
Author

@jpomfret
Copy link

jpomfret commented Apr 2, 2024

Gotcha - so I would suggest writing a PowerShell script to create the folder structure you need.. I'm not sure about how that zip gets generated - I don't believe it's something we can control I'm afraid.

@dennisa72295
Copy link
Author

It should be easy enough to take and installed version and upload it to the GitHub repo for download. What is there seems to be source code that isn't compiled yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants