dataplat / dbatools.library

dbatools smo library builder
MIT License
7 stars 8 forks source link

Module not loading #8

Open dennisa72295 opened 8 months ago

dennisa72295 commented 8 months ago

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

dennisa72295 commented 8 months ago

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 commented 8 months ago

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

I would expect

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 commented 8 months ago

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 commented 8 months ago

Where do you download the zip from? PowerShell Gallery?

dennisa72295 commented 8 months ago

https://github.com/dataplat/dbatools.library

jpomfret commented 8 months ago

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 commented 8 months ago

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.