Scripting. Powershell, VMware, Windows, Active Directory & Exchange. All that kind of stuff…..
RSS icon Email icon Home icon
  • PowerShell 2.0: One Cmdlet at a Time #67 Remove-EventLog

    Posted on February 26th, 2010 Jonathan Medd No comments

    Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Remove-EventLog cmdlet.

    What can I do with it?

    Remove an Event Log.

    Example:

    Remove the Event Log named App1 on the remote computer Test01. Confirm it has been removed with Get-EventLog.

    Remove-EventLog -LogName App1 -ComputerName Test01
    Get-EventLog -List -ComputerName Test01

    Confirmation that the App1 Event Log has been removed.

    Remove-EventLog1

    Note: To perform this task remotely you will need to ensure that Remote Event Log Management has been added as an Exception in Windows Firewall.

    Remove-EventLog2

    How could I have done this in PowerShell 1.0?

    You could have have used the .NET System.Diagnostics.Eventlog class and the Delete method to delete an event log.

    [system.diagnostics.eventlog]::Delete("App1")
    
    1000 things 1% better!
    
    

    Leave a reply