In previous article, I mentioned How To Run Multiple Commands On PowerShell but in this article, I have mentioned top basic powershell commands which a system administrator must know and use it on daily basis.

PowerShell is the go-to configuration management and job automation framework for the Windows system. It enables IT administrators to coordinate, automate, and troubleshoot typical IT tasks by combining the adaptability of a strong scripting language with the strength and speed of the command line.

PowerShell is a critical component for MSPs searching for a simple way to handle computers and servers throughout their clients' IT infrastructures.

Furthermore, PowerShell remoting allows IT, administrators, to log into PowerShell sessions and issue commands to distant Windows computers. Here, we'll review the top PowerShell commands for every system administrator.

Common PowerShell Commands

Below are some common PowerShell commands for every PowerShell user.

Get-Help

powershell-common-commands

The Get-Help command is one of the basic cmdlets for every PowerShell. It lets you access all information about available commands. Simply enter Get-Help in the command line to see the required information.

convert-HTML

common-powershell-commands

Administrators can use the ConvertTo-HTML command to integrate the data of a PowerShell command or script into a document for further evaluation or to distribute to someone else.

For instance, you can use it to develop a report that includes a list of all the active sessions on your computer and a description of their execution state. To accomplish this, run the following command:

Get-Process | ConvertTo-HTML -Property Name, Status > C:\processes.htm

Note that this command will create a web report file called processes.htm that lists the process of all active sessions, and the ‘Property Name’ in it is a placeholder.

Get-Command

basic-powershell-commands

Get-Command is a basic PowerShell cmdlet that lists all accessible cmdlets in your present PowerShell window or terminal sessions, and it also lists modules you added to PowerShell. Some of the modules are Microsoft Teams, Microsoft Exchange, etc. To execute this function, you can type 'Get-Command' in the command line.

Start-Job

Startjob.png

The Start-Job command is another essential command for anyone who uses PowerShell. Many people are unaware of this, but it can help you in real-time with your work, even as an IT professional. Here’s how.

Start-Job command lets you launch new tasks in the background instead of launching additional PowerShell windows, PowerShell sessions, or console sessions to allow "longer operating" scripts or commands to execute.

Start-Job -ScriptBlock {Get-Command}

This command will enable you to launch a background process, and the system will execute the contents in the curly brackets {}, and you can enter any command you want to execute in the field. You can also use the 'Get-Job' cmdlet to check the progress of that execution.

Stop-Process

stop process.png

The Stop-Process command is another essential command for PowerShell users that lets you terminate an active function or some of its versions. It is beneficial if an operation stops working and gets all the unique Identifiers (ID) or names of any failed process.

You can end any program by entering the Stop-Process command with the program ID or process name. Here is an example of a Stop-Process command to terminate all Notepad processes:

Stop-Process -Name notepad

You can also stop a particular process instance using its process ID. See the example below:

Stop-Process -ID 1943

Set-ExecutionPolicy

Powershell restricts scripts by default, and it may reduce your productivity as a developer. But you can control the security surrounding PowerShell scripts with the Set-ExecutionPolicy, creating your scripts. PowerShell script has four security levels that you can select as follows:

Restricted

The restricted level is the default security level that prevents the execution of PowerShell scripts, and it only lets you enter commands interactively.

All Signed

All Signed is another security level that allows scripts to run if a reliable publisher signs them. It does not give access to any script not signed by the appropriate source.

Remote Signed

Any locally developed PowerShell scripts will run at this security level if an established publisher signs them.

Unrestricted

As its title implies, the Unrestricted security level allows all scripts to execute by removing all limitations from the execution policy.

Clear-History

clear history.png

The Clear-History cmdlet is another common PowerShell command for every PowerShell user. It lets you clear the entries from your command history. Interestingly, it can also delete specific commands rather than all at a time.

Type Clear-History in the command line to execute this command.

Get-history

Even though PowerShell saves all the commands you’ve entered (up to a point), the Get-History command can give you a list of all the commands entered during the current session.

Get-History

Final Thought

This article has discussed some of the most common PowerShell cmdlets for every PowerShell user. Keep them close to boost your productivity the next time you’re working.

You may also like to read:

How to Check Motherboard Version with cmd and PowerShell

How to Add Background Image to Google Calendar Event

How to Enable or Disable Virtual TouchPad in Windows 11

How to Check Installed Powershell version