Code Monkey home page Code Monkey logo

Comments (5)

bill-long avatar bill-long commented on August 25, 2024

Looks like it throws an error when the event log is clean, so we will need to handle that gracefully.

PS C:\>  Get-WinEvent -FilterHashtable @{LogName='Application'; ProviderName='MSExchange Unified Messaging'; Level='2'} | Where-Object { $_.Message -like "*System.InvalidCastException*"}
Get-WinEvent : No events were found that match the specified selection criteria.
At line:1 char:2
+  Get-WinEvent -FilterHashtable @{LogName='Application'; ProviderName= ...
+  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (:) [Get-WinEvent], Exception
    + FullyQualifiedErrorId : NoMatchingEventsFound,Microsoft.PowerShell.Commands.GetWinEventCommand

from css-exchange.

Marc4056 avatar Marc4056 commented on August 25, 2024

That is true, but I experience the same when the eventlog is clean using the Get-Eventlog CMDlet

from css-exchange.

bill-long avatar bill-long commented on August 25, 2024

Ah you're right, we just need to tack on the SilentlyContinue like the other command had.

from css-exchange.

bill-long avatar bill-long commented on August 25, 2024

Thank you!

from css-exchange.

Marc4056 avatar Marc4056 commented on August 25, 2024

Right, forgot to take parameter "-ErrorAction SilentlyContinue" into my command

from css-exchange.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.