How to Import system modules automatically?

痞子三分冷 提交于 2019-12-19 08:21:21

问题


I am using Windows 2008 r2 64 bit system.

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?


回答1:


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

powershell.exe -ImportSystemModules

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

UPDATE:

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



来源:https://stackoverflow.com/questions/10027156/how-to-import-system-modules-automatically

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!