How to Use PowerShell
What is
PowerShell? Simply put! It gives you the capability to manage your computer from command line.
PowerShell is task-based command-line shell and scripting language built on .NET. You can use it to manage operating systems (Linux, macOS, and Windows) and processes via automated tasks. PowerShell is kind of similar to Windows command prompt but much powerful with its scripting capability.
PowerShell is supported on Windows 7, 8, 10 or newer Windows OS and most of the time it's been installed during OS installation or update, so you can go ahead to use it if you want to. If not, you can check out the system requirements for installing PowerShell
here and go ahead to install it if need to.
How to run it? It's simple, just type
powershell in Run window and click
OK as shown below:
Once the PowerShell window appears, go ahead to type
ipconfig, hit Enter and then it will show you the network configuration (IP address, subnet mask, gateway, etc.) on your computer. Basically whatever commands you can run in
traditional command prompt, such as ipconfig, ping, cd, mkdir and so on you can run them in this PowerShell.
Go ahead to
ping the IP address of other computer or gateway, you will get acknowledgement if that targeted host is active. As an example below, I pinged the IP address of my gateway (192.168.1.1) and got the response.
In addition, PowerShell supports many more commands which are called
cmdlet (pronounced "command-let") for you to manage and automate the operation in your Windows OS. Ok! Let's go through some simple and basic cmdlets for you to get started:
Issue
Get-Command (not case sensitive) cmdlet to list down all available cmdlets. You can also use * to identify more specific cmdlets. As an example, you can issue
get-command *netadapter* to list only cmdlets that contain netadapter word.
As there are many cmdlets supported in PowerShell and so it's challenging to understand the usage of each cmdlet, therefore you can always make use of
get-help cmdlet to understand each cmdlet better. As an example, use
get-help get-netadapter to learn more about this get-netadapter command.
Note: If it doesn't able to show you the help info for any particular cmdlet, run
update-help as administrator in PowerShell to update the help info, after which it should be able to show you the cmdlet help info.
Note: The other quick way to learn about a particular cmdlet is to enter the cmdlet name followed by -?. For the example above, this
get-netadapter -? will show you similar help info.
Note: Other than PowerShell CLI I mentioned above to run commands, you can also try out
Powershell ISE to run commands and write, test, and debug scripts in a single Windows-based graphic user interface.
Happy Learning!
Recommended Articles:
Installing various versions of PowerShell
10 reasons for using PowerShell ISE instead of the PowerShell console
Free Computer Virus or Worm removal tool in Microsoft Windows
Return to top of "How to Use PowerShell"!!