如何自动导入系统模块? [英] How to Import system modules automatically?

查看:34
本文介绍了如何自动导入系统模块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 Windows 2008 r2 64 位系统.

I am using Windows 2008 r2 64 bit system.

在测试我们的脚本时,我们右键单击了 powershell(存在于任务栏中)并导入了系统模块.

While testing our script ,we did right click on powershell (which is present in taskbar) and import system modules.

我们的脚本将在部署时使用.所以在目标机器我们不确定是否所有系统模块都被导入?

Our scripts will be used while deployment. So in destination machine we are not sure whether all system modules are imported or not?

如果没有导入,如何导入所有导入的系统模块?

How to make import all the system modules imported if not imported already?

推荐答案

有一个隐藏的 powershell 开关来加载系统模块:

There's a hidden powershell switch to load system modules:

powershell.exe -ImportSystemModules

系统模块位于 $pshome\modules 文件夹中.加载它们的等效命令是:

System modules reside in the $pshome\modules folder. The equivalent command to load them would be:

Get-Module -ListAvailable | Where-Object {$_.Path -like "$PSHOME*"} | Import-Module

更新:

-ImportSystemModules 开关在 v3 中没有影响,看起来它正在消失.

The -ImportSystemModules switch has no impact in v3, looks like it is going away.

这篇关于如何自动导入系统模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆