Knowledgebase

Windows PowerShell Basic Commands Cheatsheet For You

It might look scary if you are just starting with Windows PowerShell!

All BLACK SCREEN and Commands, Right?

But don’t worry!

Once you know a few basic commands, it can be a powerful tool for speeding up and simplifying your daily tasks within seconds.

This article will walk you through the most useful PowerShell commands every beginner should know. To simplify things, we will explain what each command does, why it’s used, and how to use it with examples where needed so that you can try them out yourself.

So, without wasting much time, let’s dive in and make PowerShell your new tech buddy!


Also Read: A Guide To Locating & Editing a Host File in Windows


20 Basic & Useful PowerShell Commands For You To Know

1. Get-Help

What it does: It shows you help info about a command.

Why use it: It is used to understand what a command does and how to use it.

How to use:

Get-Help Get-Process

2. Get-Command

What it does: It helps you to list all available PowerShell commands.

Why use it: It helps you to explore commands or search for specific ones.

How to use:

For example, to find all commands related to ‘services’, use:

Get-Command
Get-Command *service*

3. Get-Service

What it does: It displays all system services.

Why use it: It helps you check whether services are running or stopped.

How to use:

In this example, wuauserv refers to the Windows Update service. This command helps you check whether the update service is running properly on your system.

Get-Service
Get-Service -Name wuauserv

4. Start-Service / Stop-Service

What it does: It starts or stops a service.

Why use it: It helps you to manage system services.

How to use:

Start-Service -Name wuauserv
Stop-Service -Name wuauserv

5. Get-Process

What it does: It lists all running processes.

Why use it: It helps you to monitor or inspect processes.

How to use:

For example, if you want to check a specific one, like ‘Notepad’, if it’s open:

Get-Process
Get-Process -Name notepad

Also Read: How Can You Find The Location of the Windows Log Files?


6. Stop-Process

What it does: It ends a running process.

Why use it: If you want to close unresponsive apps, use this command.

How to use:

For example, if ‘Notepad’ is running and you want to close it, use:

Stop-Process -Name notepad

7. Set-ExecutionPolicy

What it does: It changes script execution permissions.

Why use it: It helps you to allow or restrict running scripts, which means you can control which scripts run.

How to use:

Here we are setting the policy to ‘RemoteSigned’

Set-ExecutionPolicy RemoteSigned

8. Get-Location

What it does: It shows you the current directory.

Why use it: It helps you to know where you are working.

How to use:

Get-Location

9. Set-Location (cd)

What it does: It changes the working directory.

Why use it: With this command, you can move between folders.

How to use:

Set-Location C:\Users

10. Get-ChildItem (dir)

What it does: It lists your files and folders.

Why use it: This command helps you to view directory contents.

How to use:

Get-ChildItem

Also Read: How to Launch Windows Internet Information (IIS) Manager?


11. Copy-Item

What it does: It copies files or folders from one location to another.

Why use it: You can use this command when you want to create a backup, duplicate a file, or move data to a different folder or drive without deleting the original file.

How to use:

Copy-Item C:\File.txt D:\Backup\

12. Move-Item

What it does: It moves files/folders from one location to another or renames files/folders.

Why use it: It helps you organize files by moving them into the right folders or renaming them without a mouse.

How to use:

Move-Item C:\File.txt D:\Docs\
Move-Item File.txt NewFile.txt

13. Remove-Item

What it does: It deletes files or folders from your system.

Why use it: You can use it to clean up unwanted files or folders, free up space, or remove outdated data.

How to use:

Remove-Item C:\OldFile.txt

14. New-Item

What it does: This command creates new files or folders in a specific location on your system.

Why use it: It helps you quickly create a blank file to edit later or create a new folder to organize your files without opening File Explorer.

How to use:

New-Item C:\Test\demo.txt -ItemType File
New-Item C:\TestFolder -ItemType Directory

15. Clear-Host (cls)

What it does: It clears everything currently visible in your PowerShell window, including previous commands, outputs, and any clutter on the screen.

Why use it: Sometimes, your screen is filled with too many lines, making it hard to focus. In that case, you can use this command.

How to use:

Clear-Host

Also Read: How to Update SQL Server Management Studio?


16. Get-History

What it does: It shows you all the past commands that you have run.

Why use it: It helps you to review what commands you have run.

How to use:

Get-History

17. Invoke-Command

What it does: It runs one or more PowerShell commands or scripts inside a script block ({}) on your local or remote computer.

Why use it: It’s useful when you want to group multiple commands or when you need to run a command remotely without manually logging into another system.

How to use:

Here, we will find the current date and time, just like ‘Get-Date’, but it’s wrapped inside Invoke-Command.

Invoke-Command -ScriptBlock { Get-Date }

18. Out-File

What it does: It saves the output of a command into a text file.

Why use it: When you run commands in PowerShell, the results are usually shown on the screen. But sometimes, you may want to save that output later, to share with someone or keep a log.

How to use:

Get-Process | Out-File C:\processlist.txt

19. Get-Content

What it does: It reads the contents of a file and displays it line by line.

Why use it: When you want to quickly check what’s written inside a text file, log file, or any file with readable content, you can use this command.

How to use:

Get-Content C:\notes.txt

20. Test-Connection

What it does: This command sends a series of test messages called ‘pings’ to another computer, server, or website to check whether the system is reachable over the network.

Why use it: It helps you see if your computer can connect to another system, such as checking if the Internet is working or if a server is online and responding.

How to use:

Test-Connection google.com

Also Read: How to Check Users Logged in Remote Desktop?


Conclusion

And there you have it! These basic PowerShell commands are your first step into a much more powerful way of managing your Windows system. You can use them to check services, copy files, or just check if your internet is working.


We also suggest not to worry if you don’t remember everything immediately. The more you use these commands, the more comfortable you will get. It might feel slightly different at first, but once you get the hang of it, you will wonder how you ever managed without it!


Happy scripting!