PowerShell Basic to Administrator

Run below command to get help

Get-Help Get-service -ShowWindow

 


To get the status of multiple services you can run below command.

Get-Service -Name BITS, wuauserv, W32Time

 


To get the status of multiple services starting with B, A,W you can run the below command.

Get-service -name B*, a*, W* 

You can also use short name of command or service to get status 

Get-Service bits 


gsv bits (GSV= Get-Service)

 


Command to check all Event log

Get-EventLog

Command to check System log

Get-EventLog -LogName System

Command to check last 3 system newly error related log

Get-EventLog -LogName System -Newest 3 -EntryType Error

 


Command to check last 3 system newly error related log of Remote Machines

Get-EventLog -LogName System -Newest 3 -EntryType Error -ComputerName comp1, comp2, comp3 

 

 

Use of Pipeline | in powershell ->

 

In PowerShell, the vertical bar ( | ) is the pipe symbol. This tells PowerShell that you want to take the output of one command and pass it as the input (or pipe it) to the next command.

From pipeline Left command output will be input for right command.

 


Get-Service -Name BITS, wuauserv, W32Time

Get-service -name B*, a*, W*

Get-Help Get-service -ShowWindow

Get-Service -DisplayName windows

Get-Service bits

gsv bits

Get-EventLog -LogName System -Newest 3 -EntryType Error -ComputerName comp1, comp2, comp3

Get-Module -ListAvailable 


No comments:

Post a Comment

Featured Post

HPE MSA 2040 configuration step by step

HPE MSA 2040 configuration Default IP range for HP SAN storage MSA 2040 is 10.0.0.1/2 You need to connect your laptop and storage with...