ImportDependency

0.4.16

Apteco PS Modules - PowerShell import dependencies

Module to import dependencies from the PowerShell Gallery and NuGet.

Please make sure to have the Modules WriteLog and PowerShellGet (>= 2.2.4) installed.

Minimum PowerShell version

5.1

Installation Options

Copy and Paste the following command to install this package using PowerShellGet More Info

Install-Module -Name ImportDependency

Copy and Paste the following command to install this package using Microsoft.PowerShell.PSResourceGet More Info

Install-PSResource -Name ImportDependency

You can deploy this package directly to Azure Automation. Note that deploying packages with dependencies will deploy all the dependencies to Azure Automation. Learn More

Manually download the .nupkg file to your system's default download location. Note that the file won't be unpacked, and won't include any dependencies. Learn More

Owners

Copyright

(c) 2026 Apteco GmbH. All rights reserved.

Package Details

Author(s)

  • florian.von.bracht@apteco.de

Tags

powershell Windows Linux Apteco

Functions

Import-Dependency Get-PSEnvironment Get-TemporaryPath Get-PythonPath Get-PwshPath Get-LocalPackage

PSEditions

Desktop Core

Dependencies

Release Notes


0.4.16 Added a new function Select-CompatiblePackage to select the best matching version of a package
      for the current runtime and framework, and updated Import-Dependency to use it. This allows
      Import-Dependency to load the correct DuckDB.NET build for Windows PowerShell 5.1 (netstandard2.0)
      vs PowerShell Core (Windows and Linux)
0.4.15 Fixed Get-LocalPackage returning the .nupkg FILE itself as Path for packages found via the zip
      branch (Source="zip"), instead of the folder containing it. Install-Package -Destination extracts
      lib/ref/runtimes as siblings of the .nupkg it keeps, but Import-Dependency's loader does
      Get-Item -Path $pkg.Path and then Test-Path "<Path>/lib" -- which is always false (silently, no
      error) when Path is a file. This caused Import-Dependency to report 0 for every load/fail counter
      even though packages were found and their files were completely valid, e.g. Npgsql/DuckDB.NET
0.4.14 Fixed InstalledModules/InstalledGlobalPackages only ever being scanned once, at module import
      time. Update-BackgroundJob only received results from jobs already in flight and never started
      new ones, so every Get-PSEnvironment call after the first silently returned the same stale
      snapshot -- newly installed modules/packages only showed up after Import-Module -Force. The job
      start logic is now in Start-EnvironmentBackgroundJob, which Update-BackgroundJob calls again
      whenever no jobs are currently running, so it genuinely re-scans on every non-skipped call
0.4.13 Fixed the same staleness problem for PackageManagement/PowerShellGet: Get-PSEnvironment was returning the
      version cached from module import time instead of the current one, causing repeated unnecessary
      "outdated, updating now" attempts even after PackageManagement/PowerShellGet had already been updated
      mid-session. New Get-LatestModuleVersion is now checked live on every Get-PSEnvironment call
0.4.12 Fixed Get-PSEnvironment returning a stale VcRedist status cached from module import time. It is now
      always re-checked live, so installs/removals done after import (e.g. via InstallDependency's
      Install-VcRedist) show up immediately on the next Get-PSEnvironment call
0.4.11 Adding some more verbose output to help with debugging
      Fixed module import failing with "Access is denied" in locked-down environments like Windows Sandbox,
        where the Get-CimInstance fallback for architecture detection is blocked. Now falls back further to
        Is64BitOperatingSystem, which does not need WMI/CIM access
0.4.10 Fixed a problem when getting the python path on Windows
      Fixed a problem with powershell core where a path was tried to be loaded, even when pscore is not installed
0.4.9 Added a check to remove inaccessible paths from PSModulePath to avoid errors when loading modules
0.4.8 Added all executionpolicies to Get-PSEnvironment
     Fixed a problem with checking elevation on Linux and MacOS
0.4.7 Suppressing runtime loading message
0.4.6 Added pscore/linux compatiblity to load native linux/macos assemblies from runtimes folder
0.4.5 Fixed a problem with loading native assemblies from runtimes folders
0.4.4 Added an internal switch for -verbose output
     Fixed a problem with loading local packages when using the wrong path
0.4.3 Fixed a problem with loading local packages when using Id rather than Name
     Changed the way how to load the frameworks preferences in packages
0.4.2 Changed the way on how to load modules
0.4.1 Fixed a typo in Import-Dependency after tests with Ubuntu
0.4.0 Adding verbose output when import-module
     Changing the way how we load module and package metadata for better performance
     Cosmetic changes on code
     Determination if pwsh is 64 bit is now a background job
     Added a new function to load packages from specific folders without Get-Package
0.3.15 Fixed a problem with powershell core and indefinite running of Get-Package
      Added executionpolicy for machine to Get-PSEnvironment
      Added net471 and netcoreapp2.0 to framework preferences
      Added win to runtime preferences with loading logic
      Removed old comments and code
0.3.14 Fixing the a missing return value for 0.3.13
0.3.13 Using Get-Module -ListAvailable rather than Get-InstalledModule to avoid problems with PowerShellGet and PSCore
0.3.12 Fixed a bug with choosing the wrong runtime folder when loading packages with native dlls
0.3.11 Fixed a problem with $psedition variable that is already existing and read-only
0.3.10 Added a hint when PowerShellGet is not installed in PowerShell Core
      Fixed a problem with $null logfiles in Import-Dependency
0.3.9 Fix for vcredist, when there is only one version installed
0.3.8 Added more default information about PSCore, if installed (but also when not currently used)
     Fixed getting pwsh path on Windows and Linux
     Fixed loading of module and script path
0.3.7 Returning absolute logfile path rather than a relative one
0.3.6 Adding a function Get-TemporaryPath to get a temporary path on Windows and Linux
     Adding two functions to get pwsh and python path
0.3.5 Adding Linux functionality for current executing user and if it is sudo/elevated
0.3.4 Added more switches to get faster execution of Get-PSEnvironment
     Added a synopsys to Get-PSEnvironment
     Changed the approach to load the versions of PowerShellGet and PackageManagement
     Loading the OS directly at the start of module import to determine if PATH needs to be extended
0.3.3 Fixed a problem when VCRedist is not installed at all
0.3.2 Added functionality to load global and local packages into Get-PSEnvironment
0.3.1 Added check of vcredist, powershellget and packagemanagement version
0.3.0 Re-publication as module rather than a script
     Support for PowerShell Core for Windows and Linux, possibly MacOS
     Support for Windows ARM64 architecture
     Added function Get-PSEnvironment to get information about the current PowerShell environment
0.2.0 Added support for loading runtimes with Windows ARM64 architecture
0.1.4 Removed to not load WriteLog module as it is already required here
     Changed Get-LogfileOverride to new parameter KeepLogfile as WriteLog is loaded
       in this script and Get-LogfileOverride will always be the default value
0.1.3 Change the last message to VERBOSE instead of INFO
0.1.2 Fixed temporary module and script path loading
0.1.1 Improved the missing module load
0.1.0 Improving documentation, adding PATH variables, missing modules will not throw an error anymore
0.0.8 Added a parameter switch to suppress warnings to host
0.0.7 Added a note in the log that a runtime was only possibly loaded
0.0.6 Checking 64bit of OS and process
     Output last error when using Kernel32
     Adding runtime errors to log instead of console
0.0.5 Make sure Get-Package is from PackageManagement and NOT VS
0.0.4 Make sure to reuse a log, if already set
0.0.3 Minor Improvements
     Status information at the end
     Differentiation between .net core and windows/desktop priorities
0.0.2 Fixed a problem with out commented input parameters
0.0.1 Initial release of this script

FileList

Version History

Version Downloads Last updated
0.4.16 (current version) 28 7/21/2026
0.4.15 27 7/21/2026
0.4.14 7 7/20/2026
0.4.12 8 7/20/2026
0.4.11 4 7/20/2026
0.4.10 77 5/12/2026
0.4.9 98 3/27/2026
0.4.8 82 1/23/2026
0.4.7 8 1/22/2026
0.4.6 8 1/22/2026
0.4.5 9 1/22/2026
0.4.4 7 1/21/2026
0.4.3 16 12/23/2025
0.4.2 17 12/10/2025
0.4.1 14 12/8/2025
0.4.0 9 12/8/2025
0.3.15 20 11/19/2025
0.3.14 13 11/7/2025
0.3.13 8 11/7/2025
0.3.12 11 11/6/2025
0.3.11 14 10/30/2025
0.3.10 16 10/22/2025
0.3.9 7 10/22/2025
0.3.8 10 10/21/2025
0.3.7 28 9/30/2025
0.3.6 11 9/30/2025
0.3.5 11 9/29/2025
0.3.4 7 9/29/2025
0.3.3 24 9/26/2025
0.3.2 12 9/25/2025
0.3.1 7 9/25/2025
0.3.0 12 9/19/2025
Show more