POWERSHELL
get-help about_operator
get-help where-object
get-service | where-object {$_.status -eq "running"}
get-service | where-object {$_.name -eq "winrm"}
get-eventlog -logname application -Newest 50 | where-object {$_.EntryType -eq "error"}
get-hotfix | where-object {$_.Description -eq "update"}
get-hotfix | where-object {$_.Description -ne "update"}
get-help about_comparison_operators
Less than:
get-process | where-object {$_.Handles -lt "100"}
get-hotfix | where-object {$_.InstalledOn -gt "01/01/2020"}
get-hotfix | where-object {$_.InstalledOn -gt "01/01/2019"}
get-hotfix | where-object {$_.InstalledOn -gt "01-01-2019"}
Like:
get-service | where-object {$_.displayname -like "Application*"}
get-process | where-object {$_.ProcessName -like "*host*"}
get-service | where-object {$_.displayname -like "*manager"}
logical operator:
================
get-help about_logical_operators
AND:
get-service | where-object {$_.Status -eq "running" -and $_.DisplayName -like "windows*"}
get-process | where-object {$_.Handles -gt 500 -and $_.Handles -lt 700}
get-hotfix |where-object {$_.Description -eq "update" -and $_.InstalledOn -gt "01/01/2019"}
get-help where-object
get-service | where-object {$_.status -eq "running"}
get-service | where-object {$_.name -eq "winrm"}
get-eventlog -logname application -Newest 50 | where-object {$_.EntryType -eq "error"}
get-hotfix | where-object {$_.Description -eq "update"}
Not equal:
get-help about_comparison_operators
Greater than:
get-process | where-object {$_.Handles -gt "1500"}
get-process | where-object {$_.Handles -lt "100"}
greater than date:
get-hotfix | where-object {$_.InstalledOn -gt "01/01/2019"}
get-hotfix | where-object {$_.InstalledOn -gt "01-01-2019"}
Like:
get-service | where-object {$_.displayname -like "Application*"}
get-process | where-object {$_.ProcessName -like "*host*"}
get-service | where-object {$_.displayname -like "*manager"}
logical operator:
================
get-help about_logical_operators
AND:
get-service | where-object {$_.Status -eq "running" -and $_.DisplayName -like "windows*"}
get-process | where-object {$_.Handles -gt 500 -and $_.Handles -lt 700}
get-hotfix |where-object {$_.Description -eq "update" -and $_.InstalledOn -gt "01/01/2019"}
Comments
Post a Comment