
The Linux operating system has long offered more power and flexibility to its administrators through shell scripting. However, Microsoft Windows lacked this flexibility, because of the limited capabilities of the command prompt.
To overcome this limitation, Microsoft introduced PowerShell to efficiently automate tasks and manage configurations. It is built on top of the .NET Framework and provides complete access to COM and WMI.
PowerShell is a tool for scripting and task automation on Windows systems. PowerShell by default has cmdlets, which perform predefined tasks.
There are hundreds of PowerShell cmdlets available, designed to do various administrative tasks.
1. Stop-Process
This will forcefully close the Firefox browser if it is running.
Command: Stop-Process -Name Firefox
2. Get-Process
This will list all processes currently running on the system in tabular format.
Command: Get-Process | Format-Table
3. Get-EventLog
This will print all “Security” related event logs from the current system.
Command: Get-EventLog -Log “Security”
4. Export-Csv
This will export all “Security” related events to the file security.csv on the E drive.
Command: Get-EventLog -Log “Security” | Export-Csv E:\security.csv
5. Get-Service
This will print a list of all services on the current system and their status, in tabular format.
Command: Get-Service | Format-Table
6. Get-Help
This will print detailed usage information about the Format-Table cmdlet.
Command: Get-Help Format-Table
7. Get-CimInstance
This will get details about the operating system currently installed on the system.
Command: Get-CimInstance CIM_OperatingSystem
8. Get-WmiObject
This lists all the local users on the current system.
Command: Get-WmiObject -Class Win32_UserAccount -Filter “LocalAccount=’True'”
You may also like:- Top 6 Advanced Techniques in Penetration Testing
- Top 4 Advanced Metasploit Techniques for Penetration Testers
- Exploit Writing for Beginners – A Step-by-Step Guide
- 15 Essential Windows Command Prompt Commands for Everyday Use
- Most Common DNS Record Types and Their Roles
- Top Skills Needed to Become a Cybersecurity Analyst
- Mastering Windows Management with WMIC Commands – Top 20 Examples
- Edit and Compile Code with the Best 5 Code Editors
- 50+ Top DevSecOps Tools You Need To Know
- Learn How to Add Proxy and Multiple Accounts in MoreLogin