Powershell boot automatically loads snapin and module

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.