Prerequisites
Steps to reproduce
We have an internal module, let's call it "TShell". It exports a command called "Open-Device".
If I run Get-Command Open-Device, then it will show me the command from the TShell module. If it hadn't been previously loaded, gcm triggered module auto-load, so TShell is always loaded afterward.
Hm, could I bypass this auto-load-during-query behavior? It seems like the -ListImported switch is exactly what I want--the documentation says it will "get only the commands in the current session."
But no: Get-Command Open-Device -ListImported still triggers TShell module auto-load.
(This also makes the -ListImported switch totally pointless: yeah, it only shows commands that are in the current session... but only because it already loaded them!)
Expected behavior
Don't trigger module auto-load when running `gcm -ListImported`.
Actual behavior
Modules get auto-loaded... so now the commands are imported (when they weren't before).
Error details
Environment data
Name Value
---- -----
PSVersion 7.6.5
PSEdition Core
GitCommitId 7.6.5
OS Microsoft Windows 10.0.26687
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.4
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Visuals
No response
Prerequisites
Steps to reproduce
We have an internal module, let's call it "TShell". It exports a command called "
Open-Device".If I run
Get-Command Open-Device, then it will show me the command from the TShell module. If it hadn't been previously loaded,gcmtriggered module auto-load, so TShell is always loaded afterward.Hm, could I bypass this auto-load-during-query behavior? It seems like the
-ListImportedswitch is exactly what I want--the documentation says it will "get only the commands in the current session."But no:
Get-Command Open-Device -ListImportedstill triggers TShell module auto-load.(This also makes the
-ListImportedswitch totally pointless: yeah, it only shows commands that are in the current session... but only because it already loaded them!)Expected behavior
Don't trigger module auto-load when running `gcm -ListImported`.Actual behavior
Modules get auto-loaded... so now the commands are imported (when they weren't before).Error details
Environment data
Visuals
No response