While most users know Command Prompt, only a small number of people people heard about Windows Powershell. You may wonder what Windows Powershell is? How to use it effectively? This article will tell you all answers.

Windows Powershell Introduction

In order to understand Windows Powershell better, let’s start with the concept of Shell in computer science first. A shell is a user interface that enables you access to various services of an operating system as an administrator, which can support command lines and also include a graphical user interface.

About Windows Powershell

In November 2016, the first version of Powershell was released by Microsoft for Windows XP, Windows Server 2003 and Windows Vista. Now, Powershell is an open-source project, it can be installed on Windows, Mac OS, and even Linux platforms. 

windows-powershell

As a kind of command-line shell and scripting environment, Windows Powershell enables command-line users and scriptwriters to take advantage of .NET Framework. It was designed to specify and automate tedious tasks by creating scripts and combining multiple commands.

Pros and Cons

Every coin has two sides, so does Powershell. Here we summarized its obvious merits and demerits.

Pros

Windows Powershell boasts many advantages. Compared with CMD, the biggest merit is that Powershell enables administrators to perform remote management on the network. Besides, it has many other advantages below:

  • Better Remote Management: Powershell remote becomes the main channel for communication management on the network. At present, more GUI management consoles rely on remote, so strengthening Powerhell remotely is important for Microsoft.
  • Full Support for Object-Oriented Scripting Language: Based on a complete NET programming system, its scripts are easier to write and the stability is greatly improved. The workflow of Powershell enables users to write something like functionalities by using commands and script codes.
  • Background Jobs: Powershell runs on a single thread, so a new thread like background worker will be created if you try to invoke a NET program.
  • Interactivity: This feature allows programmers to try out some cmdlets at the console first and integrate them into larger more complicated scripts.
  • Reusability: Once the written scripts perform a specific task, it can be saved for later use and also can be merged with other scripts to perform other tasks. In other words, repetitive scripts can be operated to run scripts, which save the administrator’s time and money in configuring the machines

Cons

Windows Powershell requires NET framework to run. There are a few security risks and other inconvenience you need to pay attention to as well.

  • Potential Security Risks: Windows Powershell may bring some potential security risks. As mentioned above, many IT administrators use it to connect remotely to other computers and servers, which may leave security loopholes.
  • Web Server: Another problem is that Windows Powershell requires to run a Web server on the server when using remote functionality. This process takes up additional space on a server.

What Applications Can Be Used for Executing Powershell Scripts

When to Use Windows Powershell

If you were a network administrator or IT worker, then you will find this tool is helpful in working with Active Directory. That’s because there are hundreds of customized commands called by cmdlets, which make you more productive. So, it’s recommended that Windows Powershell knowledge is a worthwhile skill to grasp.

However, sometimes average users are confused about the differences between Windows Powershell and CMD. In the following part, we will give readers detailed information about Windows PowerShell VS CMD. Let’s keep reading to use this powerful program smoothly.

Windows Powershell VS CMD

Windows command prompt, abbreviated as CMD, is the original shell of the Microsoft DOS operating system. The different operating system has different command prompts. In Windows operating system, the command line program is cmd.exe, which is a 32-bit command-line program.

Users can run all kinds of commands to manage your computer, such as use diskpart.exe command to start managing your hard drive.

the window of cmd.exe

Windows Powershell is a new Microsoft shell that combines the old CMD functionality with new scripts/cmdlets. The cmdlets are self-contained programming objects that show the underlying administration options inside of Windows. It can be used to specify complicated tasks with reusable scripts so as to save time.Well, users can also utilize some practical Powershell commands to manage your computer.

Here is a form that can help you comprehend the differences between them intuitively:

Windows Powershell

CMD

Based on scripting/cmdlets language

Based on the text scripting language

Command prompt can work in Windows Powershell.

Powershell cmdlets cannot work in cmd.exe.

t can be used to create complex scripts for managing Windows systems much more easily than using Command Prompt.

It’s not easy to perform complex scripts language.

To managing the registry to WMI (Windows Management Instrumentation), Powershell is accessible to System Administration tasks.

Cmd.exe is not accessible to System Administration tasks.

Right now, I believe you have a general understanding of Powershell. More importantly, what should we do to use Windows Powershell as a beginner? Please keep reading patiently, here are some basic Powershell commands for a novice.

Basic Powershell Commands for Novice

How to Open Windows Powershell

Type Windows Powershell in the search box and hit the Enter button. Well, you can select Run as administrator or Open file location.

input Windows Powershell in the search box

Then you will get a pop-up window like this.

the window of windows PowerShell

As a beginner, you need to know three kinds of PowerShell commands: get-command, get-help, and get-member. These basic commands will empower us to apply task-based cmdlets.

Three Useful Powershell Commands for Novice

Powerful commands are known as cmdlets. They are specialized commands in the form of a verb-noun string to perform specific functions. If you grasp this template, it’s not difficult to guess the meaning of any cmdlets.

Now, let’s see the three basic PowerShell commands.

No.1 Get-Command

In fact,using this command by itself isn’t particularly helpful. It is mainly used to outputs all commands available to you in your current session. You can find the specific commands you want to work with.

Try it now, type get-command in the window of Powershell.

type get-command and hit enter

Then as it shown to us, you can view the command type, version, name and source. For instance, if you want to find all commands that begin with the letter “c”. Just type get-command c* and hit Enter button.

all commands that begin with letter “c”

As mentioned above, powershell cmdlet names reflect the “verb-noun” template, so if you want to see all cmdlets that use verb get, just need type get-command –verb get (please note the space behind command).

all cmdlets that use verb get

Well, you can do the same thing with noun. It can help users to output a set of commands that affect the same type of object. For instance, if you want to see what cmdlets are available for managing services, just type get-command -noun service and hit enter.

type get-command -noun service

No.2 Get-Help

This command enables you to find a list of all available services on your computer, including running and stopped services. Type get-help * in the window and hit Enter.

a list of all available help topics

After opening this list of available help topics, users can get help on specific cmdlets, such as get-help get-service. Try it now.

get help on specific cmdlets

Or you can also view the same results if you type: get-service -? (Note: There should be a space after Service.)

run the command: get-service -?

Similarly, you can get services that begin with a searching string. For example, type Get-Service “wmi*” to find service names that begin with WMI.

run Get-Service

Or you can display services that contain a searching string. Type Get-Service -Displayname “*network*” to view all network-related services.

display network-related services

If you want to display all currently running services, just type Get-Service | Where-Object {$_.Status -eq “Running”}.

Tip: press shift+ on the keyboard simultaneously to get “|”.

see all current running services

N0.3 Get-Member

This cmdlet enables users to find the members, the properties and methods of a project. Let’s see the specified examples about get-member command.

Type get-service | get-member to view the properties and methods of the process objects.

Note: This command uses the pipeline operator “to send the output of a Get-Service command to Get-Member”.

type get-service | get-member

If you want to get all of the members (properties and methods) of the service objects that represent the services on the system, just type Get-Service | Get-Member –Force command. (press shift+ on the keyboard simultaneously to get “|”)

run Get-Service | Get-Member –Force command

Right now, three basic Powershell commands are told to you. You can run these commands based on your own needs.

How to Manage Your Hard Drive with Powershell

As we mentioned above, Windows Powershell is similar to CMD, and some users manage their hard drive by using the Diskpart command in CMD. Do you know how to use Powershell commands to manage your hard drive partitions? Here we take extending and shrinking partition for example. 

There are detailed steps to guide you in extending and shrinking partitions.

Step 1. Open Windows Powershell by typing Windows Powershell in the search box and hit Enter button

Step 2. In the pop-up window, type diskpart and hit enter.

Step 3. Type list disk to get all disks on your computer.

Step 4. Type select disk* and hit enter.

Step 5. Type list partitions and hit enter to list all partitions on the target disk.

Step 6. Type select partition* and hit enter

the process of extending a partition

Then you can type shrink desired=*(e.g.: size=1000 MB) to shrink the partition and hit Enter. Or you can repeat step 3 to step 6 to select another disk or partition to shrink.

run shrink desired=* command

Although this is a powerful tool, sometimes you may have difficulty in extending or shrinking partitions. For example, you receive the error message: “there is not enough usable space to extend partition” but in fact, there is enough free space.

cannot extend the partition for the file system

So, why not choose a more convenient and simpler tool to manage your hard drives.  MiniTool Partition Wizard is the best partition manager that enables you to move/resize partition easily and freely in Windows 10/8/7. Besides, this powerful software also enables you to create a CD/DVD or USB flash bootable media when system crash.

Let’s see how to resize partition with MiniTool Partition Wizard.

Step 1. Launch this powerful software. Then select a target partition and click Move/Resize partition feature from the left action panel.

 click Move/Resize partition feature from the left action panel

Step 2. Then you have three options:

  1. Drag the yellow handle leftward to shrink the partition.
  2. Drag the yellow handle rightward to enlarge the partition.
  3. Move the whole yellow handle towards unallocated space.

the process of re sizing partition

Step 3. Click Apply button to execute the pending change.

click Apply to resize the partition

In addition to resizing partition, this program has other powerful features such as convert MBR to GPT, change drive letter and so on.

What a powerful program Windows Powershell is. You can use it to manage your hard drive like Diskpart. Besides, it bears a great many features you can’t imagine. Have a try now.Click to tweet

Bottom Line

This article mainly talks about Windows Powershell, including its pros and cons, basic Powershell commands and Windows Powershell VS CMD. I believe you now have an overall impression of Windows Powershell.

Besides, if you fail to resize partitions when using Powershell, there is another effective alternative for you. Any questions, please contact us via [email protected]. Welcome to share your ideas in the comment area.

  • linkedin
  • reddit