Tuesday, October 3, 2017

PowerShell -Part 1: Introduction to Powershell and how to check and change Powershell version

PowerShell -Part 1: Introduction to Powershell and how to check and change Powershell version
Powershell is a commandline tool for Windows Administrators. It hooks in to .NET Framework.
Powershell provides:
(A). cmdlets for performing common system administration tasks to manage such as:
            - The registry
            - Services
            - Processes
            - Event logs
            - Windows Management Instrumentation (WMI)
(B). A task-based scripting language and support for existing scripts and command-line tools.
(C). Common syntax, Naming Convention, Pipelining
(D). Simplified, command-based navigation of the Operating System: For example, the registry and other data stores can be accessed by using the same techniques that are used to navigate the file system.
(E). Object Manipulation: Object can be directly manipulated or sent to other tools or databases.
(F). Most importantly Powershell is an Object Based Scripting Language: Powershell provides the programming power and accessibility of an object oriented programming language in a scripting environment.

How to find your Powershell Version?
By typing $PSVersionTable in Powershell cmdlet, you can check Powershell version in your system:
Check Powershell Version

Powershell 5 is part of Windows Management Framework (WMF) 5.0. Similarly Powershell 2.0, 3.0 and 4.0 are part of WMF 2.0, 3.0 and 4.0 respectively.

Important Note:
Systems that are running the following server applications should not run Windows Management Framework 4.0:
1.      System Center 2012 Configuration Manager (Not Including SP1)
2.      System Center Virtual Machine Manager 2008R2 (Including SP1)
3.      Microsoft Exchange Server 2007
4.      Windows Small Business Server 2011 Standard

How to change Powershell Version?
You can change Powershell version by using following syntax in Powershell command-line:
powershell –version 2.0 (Here I am changing to Powershell version 2.0.)
Powershell Version Change Command in Powershell Cmdlets

Now your Powershell version changed to 4.0 and you can validate by running $PSVersionTable command
Powershell Version after changing the version

Powershell Backward Compatibility:
1.      Powershell 2.0 is fully backward compatible with 1.0. Any script written on 1.0 will run on 2.0.
2.      Powershell 3.0 and 4.0 are fully backward compatibility with 2.0.
3.      You can run 2.0 and Powershell 3.0 or 4.0 side by side on the same computer.
4.      Powershell 3.0 and 4.0 cannot be run side by side on the same computer.
NOTE: When you install either Powershell 3.0 or 4.0, they will replace Powershell 1.0.


No comments:

Post a Comment