Saturday, February 24, 2018

Introduction to Windows PowerShell


As name suggest, Windows PowerShell is powerful command line shell. Windows PowerShell is built on top of .Net framework and internally uses .Net framework objects to run commands. PowerShell uses cmdlets (“command-let”) to perform various actions. PowerShell ships with hundreds of cmdlets and you can also create your own cmdlets as per your need. Windows PowerShell is installed by default with Windows 7 SP1 onwards editions.

PowerShell is a tool and can be used to perform day to day activities. This tool is very useful to developers and administrators to do their activities and they can write scripts or programs to ease their work. Like many other shells, Windows PowerShell allows you to access file/directory system and other computer/network/remoting related information.

In this article, I’ll explain how to start PowerShell and introduce some basic commands for you to start with PowerShell.


How to start PowerShell


For windows 10 – search PowerShell on search bar. (Pre-installed with windows 10)

Once you launch PowerShell below window will appear.


You can use directory commands like DIR, CD, CD\, CD.., MKDIR, RMDIR, COPY, DEL etc with PowerShell that you already using with Command Prompt.

When you execute these commands on PowerShell, internally PowerShell uses other cmdlets. For example, when you type DIR command on PowerShell window, it will internally use Get-ChildItem command to list all directories and files.

Get-Alias


You can use Get-Alias command to check which underlying command is mapped with alias.

Get-Alias dir

To check the entire alias you can type Get-Alias command without parameter. 

Get-Alias

Get-Command


You can use ‘Get-Command’ to check what all commands available in PowerShell. You can use ‘|more’ to view details in page wise manner.

Get-Command | more



You can also search available command using wildcards like below.

Get-Command *process

You can also use verb or noun parameters to get all the commands with specified verb or noun

Get-Command -Verb get | more

Get-Command -noun process

You can use below command to check total commands currently available in PowerShell.

(Get-Command).Count

Get-Help

You can use Get-Help command to get help about any commands in PowerShell.

Get-Help Get-ChildItem | more

If you would like to know help only about specific parameter of that command then you can use below command.

Get-Help Get-ChildItem -Parameter filter

You can get help of any command in all the details with example using below command.

Get-Help Get-ChildItem -Full |more

If your PowerShell help is not updated since long time then you can use below command to update help. This command will take some time to execute and download help.

Update-Help -Force

I hope you now have some basic knowledge about how to start PowerShell and how to search various commands and get help about them. 

Thank you for reading this article. Please leave your feedback in comments below.

Reference –


2 comments: