Quantcast
Channel: PowerShell General
Viewing all articles
Browse latest Browse all 10624

Learning PS - this is what I want to do and below that is what I have- any suggestions

$
0
0
  •  
    1. List the last 50 entries in the System log using Get-WinEvent
    2. Output 2 blank lines
    3. List the last 50 entries in the Application log using Get-EventLog, sorting by Index
    4. Output 2 blank lines

Using pipes, list the entries in the Application log using Get-EventLog that were written/generated in the last 30 days, sorting by Index

get-WinEvent -log system -maxevents 50
Write-host
Write-host
get-Eventlog -log application -newest 50 | sort-object -property index
Write-host
Write-host
$ara = @(get-eventlog -log application -newest 50)
  foreach ( $element  in  $ara )
  {
$val = $element.index.ToString()

Write-Host $val
}


Viewing all articles
Browse latest Browse all 10624

Latest Images

Trending Articles



Latest Images