How to use PowerShell in Windows 10


PowerShell is effective command line tool for the Windows administrators to be more productive. It can not only create shell scripts but also background tasks and command piping like Bash Shell. A normal user though may not gain much from the Powershell. In this article we are going to take a look at Powershell basics that you can use on Windows 10.

PowerShell 5.0 is definitely an interesting improvement over earlier Powershell releases. It has an interesting set of featured being shipped with Windows 10. Some good features that you can use are - Package Management, Secure Shell (SSH) and Remote and background jobs. Like previous version of powershell you can create custom scripts too.

If you're new to Powershell then keep reading and we'll see what Powershell is and how you can use effectively.

What is PowerShell


Powershell is a program that offers command line access to operating system. It is similar to the Bash Shell in Linux or UNIX operating system. Though it doesn't have extensive commands like BASH script, it can get the most basic tasks done. Powershell can be used in automating Windows Operating system, to schedule program execution, maintain and cleanup the system. It can be also be used with other automation tools to automate tasks and generate reporting and logs.


Powershell 5.0 is installed by default inside Windows 10. You can access the Powershell by following the steps : Windows Button > Search > Powershell.

You can also pin the Powershell to the main menu. This way you can easily access the Powershell when you need it immediately. You can also use Powershell ISE for creating and executing scripts inside the Powershell. Make sure that you are setting the execution policy for the shell. That way you don't end up executing any malicious script through the shell.

How to Use PowerShell


1. Remove Pre-Installed Apps

You can use PowerShell to remove pre-installed apps. Use the following code to remove Zune Player from Windows 10 operating system.

Get-AppxPackage -Name *ZuneMusic* | Remove-AppxPackage


If you have any other app that you wish to uninstall then simply change the name between the asterix symbols.

2. Show What Packages are Installed

If you wish to see which packages are installed on the system, use the following command.

Get-Package


3. Install Package

Use the following command that installs the package using Oneget. Type the following command to install VLC package.

Install-Package -name VLC


4. Stop Running Process (Application)

Let's assume that we have Notepad app running in the background. If you wish to disable or close the app then use the following command.

Stop-Process -Name notepad


There are many other handy commands that you can use to automate tasks using Powershell. If you join Microsoft Powershell User groups or Reddit group then you'll find some of the interesting scripts that you can make use of.

PowerShell Execution Policy



By default Microsoft has disabled the execution policy to prevent the script kiddies and the malicious code from running in the background. So you have to enable the Powershell to execute the script. The levels offered by the Powershell are as follows - 1. Restricted 2. Unrestricted 3. All signed 4. Remote signed.

Know which policy is set on your computer by using following command:

Get-ExecutionPolicy


In order to get rid of the restricted policy set by default, use the following command.

Set-ExecutionPolicy Unrestricted


Package Management with Powershell



Linux and UNIX based operating system have the package management feature built-into the system. For example, Ubuntu has apt-get whereas SUSE has yum package manager. On Windows you have unofficial package management apps - OneGet, Chocolatey, Scoop. These apps helps you install the development packages like Git, Ruby and Python from the command line itself. This is handy when you wish to perform unattended installations of the software.

OneGet

Microsoft's official package management framework that helps with software installation and package discovery. As of now it doesn't have much to offer in terms of the packages that some developers need. However most of the store listed apps should be easy to install through OneGet. If you're a developer who is interested in installing development modules like Python or the Ruby then Chocolatey or Scoop is better option to install these from Powershell.

Chocolatey

This project was pitched for Kickstarter funding for their further development. And the project seems promising considering the amount of features being supported by it. Right now you can use it to install apps like VLC, 7zip, Ruby etc. And the more apps can be installed through private or public repository. You can use this app from the command prompt or Powershell, depending on your choice.

Scoop

Another package management project that supports execution through Powershell and command prompt. It doesn't have a large app database as of now but most of the essential apps are hosted . Scoop also works along with the existing framework given by the Windows. This way there is no conflict in between the package management apps. And this in turn makes no issues of dependencies or version when the software is updated or installed through different script.

Where To Learn PowerShell



There are many places to learn more about Powershell. You can go to YouTube and watch the tutorial videos. Don Jones's channel has PowerShell Tutorial that you can watch to learn from the basics. Microsoft Technet is another place to see the groups and blogs dedicated to PowerShell. If you don't mind paying for the premium course then you can join Microsoft Virtual Academy for PowerShell course.

Poweshell inside Windows 10 can be really handy if you learn how to use it for your own benefit. With version 5.0, the Powershell becomes more stronger and effective than the previous release. If you learn how to use it for the network and the administrative tasks then you can be more productive.


Attachments

Related Articles

More articles: Windows 10 Tips

Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: