Вы находитесь на странице: 1из 2

Admin Overview

PowerShell Open-Sourced!
PowerShell is an automation and configuration framework from Microsoft. It
consists of a command-line shell and an associated scripting language based on
the .NET framework. Microsoft recently open sourced PowerShell, and made it
supportable on the Linux and Mac operating systems.

W
ith the MS is partnering with
advent of a number of industry-
DevOps leading third-party
and cloud companies like Chef,
technologies, Amazon Web Services,
customers are VMware and Google, to
experimenting more name a few to create
and more with multi- a seamless experience
platform, multi-cloud across all platforms for
or multi-OS based end users.
applications. This
shift in customer Installing
demand and set-up PowerShell
environments has PowerShell has been
led to a new set open sourced to GitHub
of challenges for under the MIT licence
developers and IT (https://github.com/
administrators who PowerShell/PowerShell).
manage such complex Installing PowerShell has
infrastructure, as the been made easy.
code written in one platform needs to be supported on other To install PowerShell on Ubuntu 14.04 and above,
platforms, too. In such scenarios, customers also need to look navigate to https://github.com/PowerShell/PowerShell/
for tools that are interoperable across several platforms, and releases/tag/v6.0.0-alpha.17 and download the Debian
ensure faster and continuous business delivery. package for the respective Ubuntu OS version (for example,
MS Azure is a growing collection of integrated cloud if the Ubuntu version is 16.04 then download the package
services that developers and IT professionals use to build, powershell_6.0.0-alpha.15-1ubuntu1.16.04.1_amd64.deb).
deploy and manage applications. With one in every three Open a terminal and run the following commands:
virtual machines at MS Azure hosting Linux, Microsoft
realised the need to adopt an open source, customer-centric sudo dpkg -i powershell_6.0.0-alpha.15-1ubuntu1.16.04.1_
approach to deliver services. As a first step in that direction, amd64.deb
MS announced that it had made PowerShell open source and sudo apt-get install f
also made it supportable on the Linux and Mac operating
systems. Currently, the support is provided for Linux flavours To install on CentOS 7, give the following command:
like RHEL, Centos and Ubuntu.
PowerShell is a task-based command-line shell and sudo yum install ./powershell-6.0.0_alpha.15-1.el7.centos.
scripting language built on the .NET framework to help x86_64.rpm
IT professionals control and automate the administration
of the Windows, Linux and Mac OSs as well as the or type the following:
applications that run on them. As PowerShell is built on
top of the .NET framework, .NET Core has been ported to sudo yum install https://github.com/PowerShell/PowerShell/
Linux. This enables customers to use a single management releases/download/v6.0.0-alpha.15/powershell-6.0.0_
stack to manage all workloads. Now, developers and IT alpha.15-1.el7.centos.x86_64.rpm
administrators can experience a rich interactive scripting
language, as well as heterogeneous automation and Running PowerShell without installation
configuration management that just works perfectly. Also, If you wish to play around with PowerShell and not

24 | APRIL 2017 | OPEN SOURCE FOR YOU | www.OpenSourceForU.com


Overview Admin

install it on your system, then download the AppImage


from https://github.com/PowerShell/PowerShell/releases/
tag/v6.0.0-alpha.17 (PowerShell-x86_64.AppImage).
Follow the two steps given below. AppImage is a portable
application, which contains the bundled PowerShell and
dependencies:

chmod a+x PowerShell-x86_64.AppImage


./PowerShell-x86_64.AppImage

Alternatively, one can download the source code by


running the following command:

git clone --recursive https://github.com/PowerShell/ Figure 1: Available commands in PowerShell


PowerShell.git

If you are interested in contributing to PowerShell, refer


to the GitHub link https://github.com/PowerShell/PowerShell/
tree/master/docs/git.

Lets run some cmdlets


Once the installation is successful, open a terminal and
enter powershell. This will open the PowerShell prompt in
the same terminal. The first cmdlet we run will give us the Figure 2: Piping in PowerShell
PowerShell version information.
Lets try to find the number of cmdlets available with this PowerShell can be used as the go-to scripting language to
alpha build of PowerShell. Currently, there are 349 cmdlets perform administrative tasks.
ported and more are on the way (refer to Figure 1). The benefits PowerShell offers to users are:
Figure 2 gives another example where we pipe the result 1. Support for running heterogeneous workloads
just like in Linux scripting. 2. Interoperable tools for scalability
3. Native Linux management tasks using PowerShell [better
Uninstalling PowerShell error handling]
Just run the following command to uninstall PowerShell: 4. Support for a broad range of programming needs
(interactive shell, scripting, system programming, etc)
Sudo apt-get remove powershell covered under a single umbrella
5. Optimised for structured data, as the workflow is
Everything in PowerShell is cmdlets (verb-noun object based
semantics)for example, Get-Commands, Get-Process, PowerShell is a new addition to the Linux environment.
Clear-Host, Set-Location, etc. Another good thing about The use cases are not limited to the ones listed in this
PowerShell is that most of the Linux commands are article. By open sourcing it, Microsoft has paved the way
already ported into it. for Linux sub-systems to use MS based cloud products like
Azure Portal, etc. Slowly, this will lead to standardisation
PowerShell vs Bash between various OSs, as Bash and PowerShell will be
The differences between the Bash shell and PowerShell supported across different operating systems.
are more with regard to the end-application use cases.
Both are very strong and feature-rich automation
languages but are inherently different in the way they By: Vinay Patkar and Shubhra Rana
perceive and handle the inputs and outputs. PowerShell Vinay Patkar works as a software development engineer at
deals with structured data in the form of objects, which Dell India R&D Centre, Bengaluru, and has close to two years
can be pipelined and passed over to different commands, experience in automation and the Windows Server OS. He is
while the Bash script deals more with a bunch of strings interested in virtualisation and cloud computing technologies.
that are not formatted or structured. Shubhra Rana is a software development engineer at Dell
India R&D Centre, Bengaluru, and is interested in data mining,
Linux native management based tasks are slowly
network security and cryptography.
being ported to PowerShell. Once this process is complete,

www.OpenSourceForU.com | OPEN SOURCE FOR YOU | APRIL 2017 | 25

Вам также может понравиться