ImportSystemModules的目的是什么?使用help ImportSystemModules -Full生成一个空的shell描述。
PS 09:12 C:\src
>get-command *module*
CommandType Name Version Source
----------- ---- ------- ------
Function Find-Module 2.2.1 PowerShellGet
Function Get-InstalledModule 2.2.1 PowerShellGet
Function **ImportSystemModules**
Function InModuleScope 3.4.0 Pester
Function Install-Module 2.2.1 PowerShellGet
...发布于 2019-11-19 15:33:37
在罗杰·利普科姆的博客中,它曾经执行以下操作:
它运行
Powershell.exe -ImportSystemModules,而后者又运行ImportSystemModules命令。如果您希望每次运行PowerShell时加载这些模块,则可以将此命令作为配置文件的一部分进行调用。 Internet上的各个地方都表示它从C:\Windows\System32\WindowsPowerShell\v1.0\Modules加载可用的模块。其中包括用于管理IIS、Hyper-V等的模块. 结果,它还加载了来自C:\Users\rogerl\Documents\WindowsPowerShell\Snapins的插件。
然而,根据另一个如此回答的说法
-ImportSystemModules交换机在v3中没有任何影响,看起来它正在消失。
v6 beta 9的Powershell变更状态指出,这一论点已被完全删除:
从
-importsystemmodules和-psconsoleFile中删除参数powershell.exe。(#4995)
实际上,在Powershell核心Get-Command ImportSystemModules上运行v6无法找到命令:
> Get-Command ImportSystemModules
Get-Command : The term 'ImportSystemModules' is not recognized as the name of a cmdlet, function, script file, or operable program.为什么它仍然存在,并在v5.1和更早版本中定义?也许是为了向后兼容,v2兼容性得到了很长时间的保证。
https://stackoverflow.com/questions/58937361
复制相似问题