Previously only knew that adding a third-party module under the default path of PowerShell would allow the boot to load automatically.
PS c:\windows\system32> $env:P smodulepath-split ";" C:\users\yli\documents\windowspowershell\modulesc:\program files\windowspowershell\modulesc:\windows\system32\ Windowspowershell\v1.0\modulesc:\program Files (x86) \netapp\netapp PowerShell toolkit\modules\.
But what about the other path's module? Snapin How to deal with, today finally know can configure the profile script to configure.
The method is simple.
A new Profile.ps1 file is added to the Windowspowershell folder in the user profile of PowerShell, and then commands such as Import-module and Add-pssnapin are executed in this file. The file is automatically executed when it is powered on.
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/7A/E2/wKiom1bBaY2zCwejAAAwtf2Xj5k072.png "title=" Capture.png "alt=" Wkiom1bbay2zcwejaaawtf2xj5k072.png "/>
For example, the automatic loading of the corresponding modules and plug-ins and so on
Import-module Dataontapadd-pssnapin vmware.vimautomation.core$cred = get-credential import-module Msonlineset-executionpolicy remotesignedconnect-msolservice-credential $cred #连接到Office365 $Session = new-pssession- ConfigurationName Microsoft.exchange-connectionuri https://outlook.office365.com/powershell/-credential $Cred- Authentication Basic-allowredirectionimport-pssession $session
This article is from the "Mapo Tofu" blog, please be sure to keep this source http://beanxyz.blog.51cto.com/5570417/1742094
Powershell boot automatically loads snapin and module