Need a script for IIS log file size threshold limit exceed

  • Hi Guru,

    if any have a power shell script to track the IIS log file size and send a email alert if the log file size exceeds certain limit.

    Please share with it, as I'm new with writing power shell script or if there is any other alternative way which we achieve this requirement, kindly let me know.

    thanks in advance.

  • Kumar-386306 (2/21/2013)


    Hi Guru,

    if any have a power shell script to track the IIS log file size and send a email alert if the log file size exceeds certain limit.

    Please share with it, as I'm new with writing power shell script or if there is any other alternative way which we achieve this requirement, kindly let me know.

    thanks in advance.

    Hi,

    This will help you

    $File = Get-childitem "\\servername\folder\file.txt"

    if ($File.Length -gt 10000) #change here to adjust your file threshold

    #if condition is true .....

    # new commandlet in V2 send-mailmessage

    send-mailmessage -to "User01 <user01@example.com>" -from "ITGroup <itdept@example.com>" -cc "User02 <user02@example.com>" -bcc "ITMgr <itmgr@example.com>" -subject "Don't forget today's meeting!"

    #if condition is false .. do noting ....

    ______________________________________________________________________________________________________________________________________________________________________________________
    HTH !
    Kin
    MCTS : 2005, 2008
    Active SQL Server Community Contributor 🙂

  • Thanks a lot for script, I'll use it and get back to you surely

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply