0
0 0 0 0 0 0
0
0 0
Message
0ID:
0PW:
0forget pwd? | Join now
0
0
0
Online: Member 2 Guest 145
0
0
0


0
MSN: test104tw@hotmail.com
0
0
  • CISA Q & A 680 Questions. (2/1/2019)
  • ISC2 CISSP Q & A 1367 Questions. (1/31/2019)
  • CISCO 300-101 Q & A 579 questions. (1/29/2019)
  • CISCO 300-115 Q & A 391 questions. (1/28/2019)
  • CISCO 300-135 Q & A 213 questions. (1/28/2019)
  • Microsoft 70-740 Q & A 165 Questions. (1/24/2019)
  • Microsoft 70-411 Q & A 301 Questions. (1/18/2019)
  • Microsoft 70-333 Q & A 67 Questions. (12/25/2018)
  • Microsoft 70-332 Q & A 97 Questions. (12/19/2018)
  • Microsoft 70-414 Q & A 160 Questions. (12/7/2018)
  • Microsoft 70-764 Q & A 100 Questions. (12/5/2018)
  • Microsoft 70-743 Q & A 134 Questions. (12/3/2018)
  • Microsoft 70-743 Q & A 145 Questions. (11/27/2018)
  • Microsoft 70-765 Q & A 155 Questions. (11/22/2018)
  • EC-Council 312-49 V9 Q & A 517 Questions. (10/30/2018)
  • CWNP CWNA107 Q & A 192 Questions. (10/25/2018)
  • ISC2 CISSP Q & A 1175 Questions. (10/12/2018)
  • ISC CSSLP Q & A 210 Questions. (10/12/2018)
  • ISC GAP Q & A 235 Questions. (10/12/2018)
  • Microsoft 70-461 Q & A 304 Questions. (10/11/2018)
0
0
0
Name:
E-mail:
Telephone:
CheckCode: 0

Suggestions & Questions:

 

0
0
0
::Visitors::
001668255

 

 

How to customize your Windows PowerShell environment[3/11/2010]
[TextSizeBig Middle Small][Print]
One of Windows PowerShell's strongest traits is its extensibility. The scripting engine can be customized in many ways and extended to include functionality not available by default. Once you understand the basic terms and cmdlets, personalizing PowerShell is the next step.

Controlling your PowerShell environment

With scripting environments, there is no such thing as one size fits all. But users can control what Windows PowerShell does at start up with the following:

  • Profile
    A profile is a script that runs when PowerShell starts up. (I like to think of it like an autoexec.bat for PowerShell, which may be old school but it's still applicable.)

There are two types of profiles, and they can be stored in two locations:

    1. System profiles -- Apply to all PowerShell sessions
    2. Host-specific profiles -- Only apply to a specific host (i.e. PS+).
  • Global
    Located in $PShome, which is in System32 of the system   ( C:windowssystem32WindowsPowerShellv1.0), this profile applies to all PowerShell sessions launched on the host.
  • User
    This user-specific profile is the last profile to load. It is located in $Env:UserProfileDocumentsWindowsPowerShellprofile.ps1.

PowerShell also lets you create custom hosts with their own profiles, but that is beyond the scope of this series and delves deep into the developer space.

Extending PowerShell's functionality

Although most scripting environments include a process for extensibility, these methods are often convoluted and reserved for more experienced users. Windows PowerShell, however, offers several levels of extensibility that even the most novice users can use.

  • Function
    Functions are the easiest to add -- simply wrap a command in a function block (function {command}) -- and let the user create cmdlets of their own that can be loaded via a profile and are accessible on demand.
  • Snap-in
    Snap-ins are the primary method for adding binary cmdlets to a PowerShell session in version 1.0. Compiled code delivered by an application provider like Citrix, Vmware or Exchange, snap-ins are controlled by two cmdlets: Get-PSSnapin and Add-PSSnapin.

  • Module
    Introduced in Powershell 2.0, modules provide a bridge between functions (admin-centric) and snap-ins (developer-centric). Modules can be loaded on-demand and can contain binary cmdlets, functions and scripts, which are managed with the following:
    • Get-Module -- Gets currently loaded modules
    • Import-Module -- Imports a module
    • Remove-Module -- Removes a module from the current session
    • New-Module -- Creates a module that lives in memory only.

Overall, there is plenty of room for growth in Windows PowerShell -- for everyone from the novice admin to the most experienced developer. Check out the following cmdlets for more information:

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


0