PowerShell-2

In this article, let’s see what PowerShell modules are and how they help system administrators & developers in automation of regular and routine tasks.

Here is the typical definition of a module

module is a set of related Windows PowerShell functionalities that can be dynamic or persist on disk. Modules that persist on disk are referenced, loaded, and persisted as script modules, binary modules, or manifest modules. Unlike snap-ins, the members of these modules can include cmdlets, providers, functions, variables, aliases, and much more.

There are different types of PowerShell Modules like

  • Script Modules
  • Binary Modules
  • Manifest Modules
  • Dynamic Modules

You can go through this MSDN LINK for more detailed description of different PowerShell modules

In simple terms a module is nothing but a kind of header library as in C programming. Each module contains different set of cmdlets to perform different actions based on the application used.

So, before we want to use/manage the application from PowerShell it is required to import/save/store the module files/binaries in local disk or a shared drive.  These modules can be stored in user’s My documents or system root drive where PowerShell is installed.

user\documents\windowspowershell\modules\mymodule

windows\system32\windowspowershell\V1.0\modules\mymodule

Remember, you need to have administrator privileges to store in system root folder. Here are few commands

Import-Module – Use this command to import any module into PowerShell session.

Get-Module – Lists out the information of all modules that have been or that can be imported to current PowerShell session.

Remove-Module – Removes module from current PowerShell session.

Before installing/importing any module the execution policy have to be set as unrestricted in the PowerShell session.

ExecutionPolicy

To list out the existing modules in the library,

PowerShell_ModulesList

So, you can directly import any of the existing modules by using import-module cmdlets. But in case you want to import any other module, you need to first download and copy to the any of the folders mentioned above.

In next article let’s learn few basic cmdlets and start writing small scripts.

Happy Learning !!!

 Link to first article

PowerShell

It’s been quite long time that I wrote any articles in my blog. So, this time I would like to write few articles on PowerShell.

PowerShell, most of us have been hearing this word from quite few years.  What it means to us as System Administrators? Even I was going through several blogs about the power of this Microsoft Shell.

Before PowerShell was released along with Windows Server 2003 SP2/Windows Server 2008, somewhere the windows system administrators used to have a doubt/fear that they may lose their job/work as most of Microsoft Applications/Technologies were GUI (Graphical User Interface) based. All installations, server management were done by respective management consoles.

PowerShell made our jobs more secure and improved automation of quite few simple daily tasks.

Using PowerShell daily/routine administrative tasks can be performed by using cmdlets (Command-Lets) by writing a simple script. Several cmdlets can be grouped together in scripts, executable files (exe files) or by instantiating regular .NET classes or WMI/COM Objects.  The script works by accessing data from different places like filesystem or registry of a system.

Those who are working on Windows Server 2003 with SP2 version can install PowerShell from this LINK.  Pre-requisite for PowerShell is the server is to be installed with .Net Framework from Add/remove components.

PowerShell Command Line Interface (Start à Run à Powershell)

powershellCLI

PowerShell Editor (Start à Run à Powershell_ise)

Powershell_Editor

In my next article I would explain how PowerShell can be used for administrative tasks, common cmdlets, modules etc.