getting remote eventlog is error RRS feed

  • 問題

  • my code like this:

    $1min = [DateTime]::Now.Addminutes(-10000)

    $MyEvtLog = New-Object System.Diagnostics.EventLog("Application", "remotemachine")

    $body=$MyEvtLog.entries  |SELECT SOURCE,TIMEGenerated,timewritten,eventid |Where-Object { ($_.eventID -eq 208 -and  $_.TimeGenerated -ge $1min  )  }

    but I get the follwing error message:

    An error occurred while enumerating through a collection:
    2009年4月13日 上午 08:53


  • Hi

    1. Did you start the WMI service in the "remotemachine" ?
    2. Did you have the local permission at the "remotemachine" ?
    3. Did you stop the firewall service or exclude the WMI protocol from firewall setting??

    2009年5月6日 上午 02:22