Simple questions: What is PowerShell in Windows, and what you can do with it?
While many casual users know about the Command Prompt, only a few have heard about Windows PowerShell. PowerShell is a much more powerful tool than the Command Prompt. It is also intended to replace the Command Prompt, as it delivers more power and control over the Windows operating system. That's why we decided to get a taste of PowerShell and explain to all our readers what this tool is, why it is so powerful and who tends to use it more often. Let's see what PowerShell is and what you can do with it:
What is PowerShell in Windows?
To give you a better understanding of PowerShell, we should first define what a shell is. No, we're not talking about a turtle's shell. :) In computer science, a shell is a user interface that gives you access to various services of an operating system. A shell can be command-line based, or it can include a graphical user interface (GUI).
Windows PowerShell is a shell initially developed by Microsoft for the purposes of task automation and configuration management. PowerShell is now an open source project, and it can be installed on Windows, macOS, and Linux platforms. This shell is based on the .NET framework, and it includes a command-line shell and a scripting language.
The first version of PowerShell was released in November 2006 for Windows XP, Windows Server 2003 and Windows Vista. The latest version of PowerShell is Windows PowerShell 5.1, and it is delivered 2016 as part of Windows 10 Anniversary Update and Windows Server 2016. It also works with Windows Server 2008 R2, Windows Server 2012 and Windows Server 2012 R2, Windows 7 Service Pack 1 and Windows 8.1 (Pro and Enterprise editions).
What can you do with PowerShell?
Microsoft designed Windows PowerShell as a tool that helps you automate and quickly solve a lot of tedious administration tasks. For example, you can use PowerShell to display all the USB devices installed on one or multiple computers in a network, or you can set a time-consuming task to run in the background while you do other work. You can also identify and kill processes that are not responding or filter specific information about computers in a network and export it in HTML format.
PowerShell's capabilities allow you to simplify and automate tedious and repetitive tasks by creating scripts and combining multiple commands.
If you are a network administrator, you find that PowerShell is helpful in working with Active Directory. Given that it contains hundreds of customizable commands, which are called cmdlets, PowerShell can be helpful in making you more productive. We recommend Ed Wilson's book - Windows PowerShell Step by Step - to learn more about it. If you desire to get a glimpse of what is new in the latest iteration of Windows PowerShell for Windows 10, you should also check this official Microsoft web page: PowerShell Documentation.
PowerShell vs PowerShell ISE
On top of the standard command-line shell, you can also find the Windows PowerShell ISE. ISE stands for Integrated Scripting Environment, and it is a graphical user interface that allows you to run commands and create, modify and test scripts without having to type all the commands in the command line. The tool allows the development of scripts which are collections of commands where you can add complex logic for their execution.
The ISE tool is designed for the needs of the administrators of Windows systems that need to run repeatedly sequences of commands that manipulate the configuration of these systems.
Where do you find PowerShell in Windows?
The fastest way to open PowerShell in Windows is to use Cortana's search field from the taskbar. Enter the keyword "powershell" and then click or tap the Windows PowerShell search result.
For more ways to launch PowerShell with instructions for Windows 10, Windows 8.1 and Windows 7, read this article: 9 ways to launch PowerShell in Windows (including as admin).
The PowerShell commands are called cmdlets. The easiest way to find these commands in PowerShell is to run "Get-Command -Type Cmdlet".
This produces the full list of commands available in PowerShell. You can scroll through the list until you find the right one. The number of commands in PowerShell is large, so we provide articles dedicated to one task that can be accomplished using PowerShell (search in each article for the PowerShell method when multiple ones are presented):
- Uninstall Windows 10 apps
- Reinstall all the Windows 10 default apps
- Use PowerShell To Count All The Files And Folders
- Find your IP address in Windows
- Delete a partition from Windows
- Print the list of running processes
- Find the MAC address of any network card
In this guide from Microsoft, you can find sample scripts that give you a good idea of using PowerShell commands.
For users with previous experience in Command Prompt and Linux, PowerShell has a list of aliases that associate names familiar to these users with the PowerShell commands. Here are a few examples: cat, dir, mount, rm, chdir, erase, sort, cls, del. For a full list of these aliases, run in PowerShell the command "Get-Command -Type Alias".
Who tends to use PowerShell regularly?
Without any doubt, PowerShell is the weapon of choice for many IT administrators, since it can simplify the management operations in large corporate networks.
To give you an example, let's say you are managing a large network containing over five hundred servers, and you need to implement a new security solution that is dependent on a specific service that has to run on those servers. You could, of course, log in to each server and see if they have that service installed and running. It is possible, but it is also likely that you waste too much time to finish the task. If you use PowerShell, you could complete that task in just a few minutes, since the whole operation can be done with only one script that gathers information about the services running on the servers you specify and dumps them into a text file, for instance. Now that's productivity!
How can PowerShell help you?
As you can see from this article, Windows PowerShell is an incredibly powerful tool that is included in Windows, and that is available for many other operating systems. It brings many benefits to power-users and IT professionals. However, casual users can benefit from using it too. Try it out, read our tutorials, and let us know your opinion about PowerShell. Leave a comment below and share your perspective.