error with limit-eventlog command

Welcome Forums General PowerShell Q&A error with limit-eventlog command

This topic contains 1 reply, has 2 voices, and was last updated by

4 years, 4 months ago.

  • Author
  • #19782

    Points: 0
    Rank: Member

    Hi, I'm going through the Powershell in a Month of Lunches book, and in one lab task in the Appendix it asks me to "run a command that modifies the Security event log to overwrite old events as needed." I run this command,

    limit-eventlog -logname security -overflow overwriteolder

    which I know is the correct cmdlet, but I get this error:

    limit-eventlog : Specify a valid value for the number of retention days.
    At line:1 char:1
    + limit-eventlog -overflowaction OverwriteOlder -logname security
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidData: (:) [Limit-EventLog], Exception
    + FullyQualifiedErrorId : InvalidArgument,Microsoft.PowerShell.Commands.LimitEventLogCommand

    Anyone know what I'm doing wrong? There's already a valid value for the number of retention days when I ran



  • #19783

    Points: 1,811
    Helping HandTeam Member
    Rank: Community Hero

    Limit-EventLog requires you to specify a retention period, even if one was previously set. It has to do with the way the underlying .NET stuff works.

The topic ‘error with limit-eventlog command’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort