How to personalize the PowerShell Environment

Source: Internet
Author: User

One of the strongest features of Windows PowerShell is its scalability. This script engine can be customized in many ways and extended to use features that are unavailable by default. Once you understand basic terms and cmdlets, you can then personalize PowerShell.

Control the PowerShell Environment

Using the script environment is not a panacea. However, you can use the following information to control Windows PowerShell behaviors.

Profile

Profile is the script that runs when PowerShell is started. I like to think of it as PowerShell's autoexec. bat, which may be conservative but still works .)

There are two types of profiles that can be stored in two locations:

Global

Located in $ PShome of System32, C: windowssystem32WindowsPowerShellv1.0), this profile applies to all PowerShell sessions initiated on the host.

User

The profile that the specific user document loads at the end. Located in $ Env: UserProfileDocumentsWindowsPowerShellprofile. ps1.

PowerShell also allows you to use the host documentation to create a custom host. However, this is beyond the scope of this article and has gone deep into the development field.

Extended PowerShell Functions

Although most script environments contain extensions, these methods are generally complex and suitable for more experienced users. However, Windows PowerShell provides several levels of scalability that can be quickly learned by new users.

Function

Function is the easiest to add. You only need to include a command in the function box, such as Function {command}, so that users can create their own cmdlet, load it through profile, and access it as needed.

Snap-in

Snap-ins is the main method to add a binary cmdlet to a PowerShell session in Version 1.0. Through the compilation code delivered by application vendors such as Citrix, VMware, or Exchange, snap-ins are controlled by two cmdlet: Get-PSSnapin and Add-PSSnapin.

Module

In Powershell 2.0, the module provides a bridge between the function management center and the snap-in Development Center. The Module can be loaded as needed, and can contain binary cmdlet, function, and script. It is managed through the following information:

  • Get-Module -- Get the currently loaded module
  • Import-Module -- Import module
  • Remove-Module -- Remove module from current session
  • New-Module -- create a module that only exists in the memory

In general, Windows PowerShell has a lot of room for growth for every novice and experienced developer. View the following cmdlet for more information:

  • Get-Help about_profiles
  • Get-Help about_functions
  • Get-Help about_PSSnapin
  • Get-Help about_modules

Related Article

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.