I want to use Implicitly Importing while using the PowerShell Module Az. This module has quite a lot of submodules and I don't want to import the specific version at the start of the script because of time. The script will run on an agent, which is not controlled by me, so that it could be, that a newer Az Module will be installed without my knowledge. If so, my script should still use the older version with Implicitly Importing. But I did not find a way to load older version in this way. It is always, that the newest version is used by Implicitly Importing. I could then overwrite it by importing the older version (like in the example below), but this is exactly what I don't want to do.
PS > Get-Module Impl*
PS > GetImplicitValue()
Implicit Importing from V2
PS > Get-Module Impl*
ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Script 2.1.2 ImplicitlyImporting GetImplicitValue
PS > Import-Module ImplicitlyImporting -Force -RequiredVersion 1.0.2
PS > GetImplicitValue()
Implicit Importing from V1
PS > Get-Module Impl*
ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Script 1.0.2 ImplicitlyImporting GetImplicitValue
Script 2.1.2 ImplicitlyImporting GetImplicitValue
Any idea? Thanks in advance.