potatoqualitee/blog-comments

Offline Installation of dbatools 2.0 with the dbatools.library Dependency

Opened this issue · 7 comments

Offline Installation of dbatools 2.0 with the dbatools.library Dependency | netnerds.net

If you work in an offline environment, you're probably familiar with how painful it can be to install anything, including PowerShell modules like dbatools.
In …

https://blog.netnerds.net/2023/04/offline-install-of-dbatools-and-dbatools-library/

Thank you for remembering us offline installer people. (zero trust data centers are a pain.) :D

Hi
I am calling powershell script that uses DBATools module that will extract all DBs permission and generate the scripted file. I have no issue when run the script through Windows Powershell ISE. The script run takes around 10 minutes and file get generated.
I need to automate the process so I added to sql job and when I run the job is taking too much time and it looks like stuck in in-progress state even after it generated script file.

Any help would be appreciated.

When I type Save-Module dbatools -Path C:\Temp\Offline I am getting the error No match was found for the specified criteria and module name dbatools.

Previous method for offline to download and copy paste it to powershell module directory a simpler option.

In case some one is having same problems with save-module command the one workaround that work for me is run tls then unregister then register then when I save the module it works

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Unregister-PSRepository -Name PSGallery
Register-PSRepository -Default
Save-Module dbatools

When I try to import the module, I receive an Exception re: could not load file or assembly 'system.runtime, version=6.0.0.0, culture=neutral, publickeytoken....system cannot find the file specfied
and ideas?

I have gone forward with utilizing a custom local Powershell repository. I save the nupkg file to a folder where the repository is located, then load the nupkg from the local Powershell repository.

Requires a nuget offline install and requires a local Powershell repository but works great for all my offline installs.

If you get an error stating that "the module could not be loaded", you may need to unblock the files that you copied to the offline server. Powershell conveniently has an Unblock-File command for this.