How to Import system modules automatically?

后端 未结 1 1318
失恋的感觉
失恋的感觉 2021-01-13 02:58

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.

相关标签:
1条回答
  • 2021-01-13 03:54

    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.

    0 讨论(0)
提交回复
热议问题