x32x01
  • by x32x01 ||
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.
Code:
Stop-Process -Name Firefox
2. Get-Process
This will list all processes currently running on the system in tabular format.
Code:
Get-Process | Format-Table
powershell_1.jpg
3. Get-EventLog
This will print all “Security” related event logs from the current system.
Code:
Get-EventLog -Log “Security”
powershell_2.jpg
4. Export-Csv
This will export all “Security” related events to the file security.csv on the E drive.
Code:
Get-EventLog -Log “Security” | Export-Csv E:\security.csv
powershell_3.jpg
5. Get-Service
This will print a list of all services on the current system and their status, in tabular format.
Code:
Get-Service | Format-Table
powershell_4.jpg
6. Get-Help
This will print detailed usage information about the Format-Table cmdlet.
Code:
Get-Help Format-Table
powershell_7.jpg
7. Get-CimInstance
This will get details about the operating system currently installed on the system.
Code:
Get-CimInstance CIM_OperatingSystem
powershell_5.jpg
8. Get-WmiObject
This lists all the local users on the current system.
Code:
Get-WmiObject -Class Win32_UserAccount -Filter “LocalAccount=’True'”
powershell_6.jpg
 

Similar Threads

x32x01
Replies
0
Views
36
x32x01
x32x01
x32x01
  • x32x01
Replies
0
Views
186
x32x01
x32x01
x32x01
Replies
0
Views
169
x32x01
x32x01
x32x01
  • x32x01
Replies
0
Views
334
x32x01
x32x01
x32x01
  • x32x01
Replies
0
Views
496
x32x01
x32x01
TAGs: Tags
powershell

Register & Login Faster

Forgot your password?

Latest Resources

Forum Statistics

Threads
517
Messages
518
Members
44
Latest Member
Zodiac
Back
Top