Top 10 Essential Windows PowerShell Commands You Need to Know
February 5, 2020

Within the last couple of years, Microsoft has focused on making the PowerShell management tool a top choice. If you check out all the latest Microsoft server products, you will discover that they need PowerShell to function optimally. As a matter of fact, there are many management tasks that require the command line before they can be accomplished. If you are a Windows administrator, there are ten essential Windows PowerShell commands that you need to know and use.

If you don’t know these PowerShell commands, now is the time to do it. As you may already know, PowerShell is not only about the speed of a command line but also about high-level flexibility in the scripting language. This makes it an integral Windows administration component. In this blog article, we will focus on the top essential commands that you should develop competence in to increase your value in your workplace.

1. Get-Help

This is an important cmdlet that any administrator needs to know. It can be used to get help with basically all other commands. For instance, if you need to know how the Get-Process command functions, you simply type the following: get-help -name get-process. Please note that the parameter Name is always optional. With this, the full command syntax will be displayed on the screen. In addition to this, it can also be used with specific verbs and nouns. If you are looking for different commands that you can use with the Get verb, just go ahead and type: get-help get-*

2. ConvertTo-HTML

With PowerShell, an administrator can access huge data related to a system. However, in some cases, you may require going beyond viewing the data on the screen. You may need to create a report that you can send out to your team. To do this, you will need to use the ConvertTo-HTML command line. To use the command, pipe the output from the other one into ConvertTo-HTML. It is important to mention that you will need to use the -Property switch to manage the output properties that are in the HTML file. In addition to this, you will also need to create a filename.

3. Set-ExecutionPolicy

No doubt that it is possible to create and implement PowerShell scripts in a PowerShell environment. However, by default, Microsoft has already disabled scripting to prevent any malicious code from performing in the environment. To manage the security surrounding PowerShell scripts, you can utilize the Set-ExecutionPolicy command line. Basically, four security levels that you can access include:

  • Restricted: This is the default implementation policy that locks down PowerShell for interactive command input. In this way, it will be impossible for PowerShell scripts to run.
  • Unrestricted: This eliminates every restriction from the implementation policy.
  • RemoteSigned: In the case that the implementation policy is set on RemoteSigned, locally created PowerShell scripts will be able to run. However, those scripts that have been remotely created will only be allowed to run if they have been signed by a trusted publisher.
  • AllSigned: If the implementation policy is on AllSigned, PowerShell scripts will be able to run if they have been signed by a trusted publisher.

4. Get-Service

This command offers a list of different services that have been installed in a system. In case you want to explore a particular service, simply add the -Name switch as well as the name of the service. With this, you will be able to view the state of the service.

5. Get-ExecutionPolicy

If you are working on a new server, you have to know the specific implementation policy that is in use before you try to run a particular script. You can easily identify this by utilizing the Get-Execution Policy command line.

6. Export-CSV

As mentioned earlier, you can create an HTML report with PowerShell data. In the same way, it is possible to export data into the CSV file from PowerShell, and you can open it with Microsoft Excel. The process is almost the same as converting the command’s output into HTML. It is important to mention that you need to create an output filename to be able to do this.

7. Get-EventLog

It is also possible to utilize PowerShell to parse event logs on your computer. There are quite a number of parameters that you can access but there is a simple way to do it. Simply provide the -Log switch and follow it by the log’s filename. For instance, if you want to view the Application log, you can use the command line such as: Get-EventLog -Log Application. It is important to mention that the possibility of using such a command in a real scenario is very low. In most cases, you would probably use other lines to filter and dump the output to the HTML or CSV files but you still need to be conversant with them.

8. Select-Object

When searching for properties in the CSV file, there is usually a cluster of properties that you need to sieve through. However, you can simplify things by using the Select-Object command to add only those properties that you really want to see. The command line enables you to specify particular components for inclusion. Let’s say, you want to create the CSV file that has the name of specific system service and its status, you may use this command line to get result: Get-Service| Select-Object ‘Name’ Status| Export-CSV C:/service.csv.

9. Get-Process

As mentioned above, the Get-Service command line can be used to display a list of system services. In the same way, the Get-Process command line can be used to display the entire processes presently running on a system.

10. Stop-Process

In some cases, a specific process can freeze, and when this happens, the Get-Process command comes into play. You can use it to get the process or name ID for the particular process that is not responding. After this, you can use the Stop-Process command to terminate this process.

These are the ten essential Windows PowerShell commands that you should know as an administrator to succeed.

Leave a Reply

How It Works

img
Step 1. Choose Exam
on ExamLabs
Download IT Exams Questions & Answers
img
Step 2. Open Exam with
Avanset Exam Simulator
Press here to download VCE Exam Simulator that simulates real exam environment
img
Step 3. Study
& Pass
IT Exams Anywhere, Anytime!