The act of installing the pre-reqs would load PackageManagement and PowerShellGet at the older versions. As PackageManagement is implemented as a binary module once the dll has been loaded it cannot be unloaded. This causes problems later on when a newer parameter like -AcceptLicense is specified but the older PackageManagement does not have it.
To solve this the pre-reqs are installed in a sub process so that when this module imports it for the first time it will be at the version needed.
SUMMARY
The act of installing the pre-reqs would load PackageManagement and PowerShellGet at the older versions. As PackageManagement is implemented as a binary module once the dll has been loaded it cannot be unloaded. This causes problems later on when a newer parameter like
-AcceptLicense
is specified but the older PackageManagement does not have it.To solve this the pre-reqs are installed in a sub process so that when this module imports it for the first time it will be at the version needed.
Fixes https://github.com/ansible-collections/community.windows/issues/487
ISSUE TYPE
COMPONENT NAME
win_psmodule