Computer >> Computer tutorials >  >> System >> Windows 11

Top PowerShell commands you just have to try

The Windows PowerShell is a powerhouse of task automation and system management. It helps you get things done with the help of a command line and scripting language. Out of the all cool things you can do with PowerShell cmdlets, there are some commands that stand out. In fact, these are commands without which using PowerShell wouldn’t be a good option for system administration. So lets at look at what those command are.

1. Get-Help

Do you find yourself stuck in using the PowerShell somewhere? If that’s the case, then the Get-Help command can rescue you out of the situation. Basically, the Get-Help command locates all the commands, and then helps you use those commands. You can use the Get-Help command in the following ways:

Launch the PowerShell, type in ‘Get-Help,’ and hit Enter. As you soon as you do that, you’ll see all the details about the Get-Help command.

Top PowerShell commands you just have to try

Similarly, if you’re unsure about a command, you can simply type in that command along with Get-Help to get additional information on it. Here’s how:

Get-Help -Name Get-EventLog

2. Get-Process

Your PC is running a host of processes in background at a specific time. If you’d like to know about them for whatever particular reason, then you can use the Get-Process command to get a good enough idea. Here’s how you can get started:

PS C:\ Get-Process

When you type in the above command and hit Enter, you’ll get an overview of all the programs running on your PC.

Top PowerShell commands you just have to try

3. Stop-Process

Since we’re on the topic of processes, let’s look at the Stop-Process cmdlt as well. It’s not uncommon to have random processes give up on you while you’re running your PC. In those cases, it becomes crucial to stop these processes with the help of Stop-Process command.

Here’s how you can terminate a process:

PS C:\> Stop-Process -Name “explorer”
 
In this example, we’re terminating the Windows File explorer through the Stop-Process.

Top PowerShell commands you just have to try

4. Get-History

The Get-History command throws a list of commands used in a session right at you. With its help, you can get an idea about all the command you’ve employed in a session.
Simply go to the PowerShell, type in ‘Get-History,’ and hit Enter:

Get-History

As you can see, so far, we’ve run the powershell_ise.exe and help commands oin our PowerShell.

Top PowerShell commands you just have to try

5. Export CSV

The Export CSV command comes handy when you want to export some important PowerShell data into CSV. Basically, it works by converting your PowerShell objects (which are basically quantities of something) into a series of strings, and saves them in a CSV file. Here’s how you can run this command:

Get-Service | Export-CSV c:\service.csv

6. Get-Command

If you want to get a quick idea about the different commands and types installed on your PC, you can’t go wrong with the Get-Command. Simply type in ‘Get-Command’ in the PowerShell and hit Enter. You’ll get a quick overview of all the functions, cmdlets, scripts, or alias installed on your PC.

Get-Command

Top PowerShell commands you just have to try

PowerShell commands that might come handy

PowerShell has tons of commands to try out from. Microsoft has a whole list of commands you can check out.