Search This Blog

Sunday, 2 August 2020

Powershell-firstscript

#q1: find the services are running and disaply is starting with windows the o/p should contain only status,display,starttype

get-service|where-object {$_.displayname -like "windows*"} |sort-object displayname |format-table Status,DisplayName,starttype
get-service|where-object {$_.displayname -like "windows*" -and $_.status -eq "running"} |sort-object displayname |format-table Status,DisplayName,starttype

get-process |where-object {$_.Handles -gt 500 -and $_.Handles -lt 600} | sort-object Handles |format-table Handles,ProcessName,StartTime

get-eventlog -logname application | where-object {$_.timegenerated -gt "07/25/2020 10:00" -and $_.timegenerated -lt "07/25/2020 22:00"  -and $_.EntryType -eq "Error"} | format-table TimeGenerated,Source,EntryType

get-hotfix |where-object {$_.Description -eq "update" -and $_.installedon -gt "12/26/2019 12:00"} |format-table PSComputerName,HotFixID,Caption,installedon


###########################################################

No comments:

Post a Comment