Popup message to user if defrag running?

Posted on 2007-10-16
Last Modified: 2013-11-21
I currently have a Windows 2003 server scheduled to perform a defrag each week under user NT AUTHORITY\SYSTEM. The defrag is scheduled during the middle of the night, but our employees work at all hours (who doesn't?). I am wondering if there is a way for me to have a message display (only if while defrag is taking place) to a user when they logon to the server using a RDC? Maybe a batch file that would display a message if user logs on between such and such times?
*Edit* - To clarify, my objective is to notify the user why his or her experience might be really slow if they log on during defrag--not necessarily to cancel or pause the process while the user is logged on.
Question by:nicholasjwolf
    LVL 70

    Expert Comment

    I'm sort of thinking aloud here... the only option that comes to mind is to use a NET SEND command - problem is that the Windows Messanger service is probably disabled as a security precaution so you will have to devise some way of enabling it and then disabling it again afterwards.
    LVL 8

    Expert Comment

    a message to let the person know that the server is defragmenting?

    Author Comment

    Yes, a message to let the person know that the server is defragmenting. In other words, instead of me saying, "Boss, everything is really slow right now because you're working at 2am and I need to defrag right now or it won't ever get done" it would be really cool if a popup message (even just a notepad message!) could said something to this effect. Make sense?
    LVL 26

    Accepted Solution

    :: Copy and paste following batch code into notepad and save it with any name having .cmd extension.
    :: Put this .cmd file into all users Startup folder.
    :: C:\Documents and Settings\All Users\Start Menu\Programs\Startup

    TList.exe |FIND /I "dfrgntfs.exe" >NUL
          ECHO MsgBox "Disk Defragmenter is Running",vbCritical,"WARNING" >VBMsg.vbs
          cscript //nologo VBMsg.vbs)
    IF EXIST VBMsg.vbs DEL /F /Q VBMsg.vbs
    EXIT /B /0

    Hope this helps!
    LVL 8

    Assisted Solution

    Save this as time.vbs. In the login script for admins add time.vbs to a new line at the end of the login script. Add this vbs to the scripts share. You can change the time to read 2 or 3 so on in the if statement.

    dim mytime,current
    current = Time()
    mytime = Left(current,1)
    if mytime = 3 then
    msgbox ("The computer is currently defragmenting. Please excuse the computer from running slow.")
    end if

    Author Comment

    Thank you both! -Nick

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Join & Write a Comment

    On July 14th 2015, Windows Server 2003 will become End of Support, leaving hundreds of thousands of servers around the world that still run this 12 year old operating system vulnerable and potentially out of compliance in many organisations around t…
    ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now