PowerShell is a very valuable tool for Windows administrators, it combines the flexibility of the scripting language and the speed of the command line. Microsoft has recently undertaken the task of ensuring that PowerShell is the most popular management tool. Most (if not all) new Microsoft products require it. In addition, you must execute the command line to perform many administrative tasks. To be an excellent Windows administrator, you must be completely familiar with the basics of using PowerShell. These are the ten commands you must master to develop a Windows administrator. Let’s explore them in detail.

1. Get service

Get-Service is a popular PowerShell command that provides a long list of all services installed on the system. If you are interested in a specific service, all you need to do is add the -Name switch before adding the service name. In this way, Windows will show you the status of this service.

2. Get help

Get-Help is the first PowerShell cmdlet to understand the identity of a Windows administrator. This command can be used to help you use any PowerShell command. If you don’t know how to use Get-Process, just type “Get-Help-Name Get-Process”. Get-Help can also be used with verbs and single nouns. For example, if you want to find a command that can be used with the verb “Get”, you can type a program, just type “Get-Help-Get Name”.

3. Stop the process

Sometimes any process may freeze or stop. In this case, the Get-Process command can be used to obtain the process ID or process name that has stopped responding. After determining which process, you can use this command to end it. You can stop the process based on your PID ID or name. For example, if Notepad stops responding, you can use the following command to close it with “Stop Process”: “Stop Process-Name Notepad” or “Stop Process-ID 3952”. It is worth noting that the process ID can be changed from one session to another. Therefore, it is important to know how to find this number.

4. Set execution policy

Of course, you can create and run PowerShell scripts. However, Microsoft has now disabled scripting by default to prevent malicious code from running in the PowerShell environment. The Set-Execution Policy command can be used to control the security level in the PowerShell scripting environment. There are four security levels:

All signatures: You can set the execution policy to “All signatures to run scripts.”

Restricted: This is the default execution strategy that prevents PowerShell, so commands can only be entered interactively.

Unrestricted-remove all restrictions from the execution strategy.

Remote signature: When the execution policy is set to “remote signature”, all PowerShell scripts created locally will be allowed to run. If remotely created PowerShell scripts are signed by a trusted publisher, they can only be run.

You can enter the “Set Execution Strategy” command, and then set the execution strategy according to the strategy name. For example, to allow scripts to run unrestricted, simply type “set unrestricted execution policy.”

5. Acquisition process

Get-Process is a basic command of Windows PowerShell, used to display a list of all processes currently running on the computer.

6. Enforcement policy

The Get-Execution strategy is one of the most popular basic Windows PowerShell cmdlets that all Windows administrators should be familiar with. If you are working on an unfamiliar server, you need to understand the execution strategy currently in use before attempting to run the script. If you don’t know how to find it, use this command.

7. Convert to HTML

Although PowerShell can provide you with a lot of information about the system, sometimes you do more than rely on the information displayed on the screen. It is very helpful to create good reports that can be sent to others. One of the best ways to achieve this is to use the “Convert to HTML” command. To use it, simply pass the output of other commands through the pipeline. You will need to use the -Property switch to control which output properties should be included in the HTML file. In addition, you must provide a file name.

8. Export CSV

Similarly, HTML reports can be created based on PowerShell data. You can also export data from PowerShell to a CSV file. You can use Microsoft Excel to open the file. The syntax is indeed similar to the syntax used to convert command output to HTML reports. Before exporting the data, you need to provide the name of the output file. Or, if you want to export the system service list on the system to a CSV file, you can use “Select Object” as the command name.

9. Select objects

We have determined that you have tried to use the Export-CSV command. If so, you must have noticed that the CSV file contains several attributes. In general, it is useful to restrict everything and include only those attributes that interest you. This is where this PowerShell command comes into play. Allows you to specify the attributes to be included.

10. Event Registration

You can use PowerShell to analyze the computer’s event log. There are many parameters available, but you can simply test the PowerShell command by providing the -Log switch and then confirming the name of the log file.

In conclusion

Understanding these basic Windows PowerShell commands will help you perform many tasks. But of course, if you want to become a professional, you need to know more.

Leave a Reply

Your email address will not be published. Required fields are marked *

X