Sunday, October 7, 2018

POWER SHELL COMMANDS

POwer SHELL COMMANDS

get-help workerrole
get-help webrole
get-help *content*
get-help storage
get-command *event
get-eventlog system
get-eventlog system -newest 10 // to get latest 10 log
 
get-eventlog system -newest 10 | where {$_.instanceid -eq 129} // To get the specific event
 
get-eventlog system -newest 10 | where {$_.instanceid -lt 1219} // to get all events less than event id 129
  
get-service | export-csv -path E:\Service.csv -- to export all services to E drive through command 
import-csv E:\Service.csv

TO Export all process in xml format :

get-process | export-clixml -path  e:\training.xml
TO Export all process in txt format :
get-process | out-file -filepath  e:\training.txt
To open in notepad :
invoke-item  e:\training.txt

To get all service in html format:

get-service | convertto-html

get-service | convertto-html | set-content E:\xyz.xml

To retrieve only two columns from Services:

get-service | convertto-html -property name,status


List of service starts with character “S”

get-service s*

To get process which has id less than 100
get-process | where id -lt 100

To Get service which are running using where clause in powershell:

get-service | where {$_.status -eq "running"}
get-service | where {$_.status -eq "stopped"}

<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({
          google_ad_client: "ca-pub-3599209542351256",
          enable_page_level_ads: true
     });
</script>

0 comments :

Post a Comment