How can I play a wav sound for a bad password entered at windows logon

Page 1 of 2 12 LastLast

  1. Posts : 8
    Windows 10, 64
       #1

    How can I play a wav sound for a bad password entered at windows logon


    Hello there!
    How can I play a wav file (sound file) when a bad password is entered at windows logon (Windows 10)
    Thank you.
      My Computer


  2. Posts : 42,961
    Win 10 Pro (22H2) (2nd PC is 22H2)
       #2

    Event id 4625 is generated on a failed logon
    Windows Security Log Event ID 4625 - An account failed to log on


    ..so you might be able to set up a scheduled task triggered on that event id.
    Create task, Begin Task, On event id ....

    You'd need to set up the conditions carefully e.g. run whether user is logged on or not.

    Never tried such a thing personally, so see how it goes.
      My Computers


  3. Posts : 8
    Windows 10, 64
    Thread Starter
       #3

    Thanks for the info.... no sure what to put on the task scheduler to trigger a sound after a login failure in Windows 10.

    Thanks...
      My Computer


  4. Posts : 42,961
    Win 10 Pro (22H2) (2nd PC is 22H2)
       #4

    You need to research the command line invocation for a player

    Example: I searched for
    vlc player command line

    How to Add VLC to the Command Prompt in Windows

    WMP:
    Control Windows Media Player Behaviour with Command Line Parameters - Tech Journey

    Take it step by step checking each element:

    Test your command line at a normal command prompt.

    Then add to a simple scheduled task for test purposes that you then run manually- just to check that works.

    Then you can try creating the task you want.


      My Computers


  5. Posts : 14,006
    Win10 Pro and Home, Win11 Pro and Home, Win7, Linux Mint
       #5

    I see it a bit differently, many things in Windows don't work until after the user has logged on, sound features other than what may be built-in to base files that load the OS like used to play in older versions when they started up.
      My Computers


  6. Posts : 42,961
    Win 10 Pro (22H2) (2nd PC is 22H2)
       #6

    Hi, granted, that's why I said 'might' at the start and that I'd not tried it. That's just the only kind of option I can think of. Whether it's feasible.. we'll see.

    I've done a little more research for you: this is how to get vlc playing a sound without having vlc display anything at all from a command prompt:

    "D:\Multimedia\Players\VLC player\vlc.exe" -I dummy --dummy-quiet "E:\My sounds\alert.wav" vlc://quit

    Here I've explicitly given the path to vlc player on my PC; note the "" around strings containing a space.
    Naturally you will need to change the paths on yours.

    Reference:
    VLC Comman Line Options like no GUI --play-and-exit ? - The VideoLAN Forums

    Create a bat file containing that command line- test it from a command prompt.
    The bat file is what you execute from your scheduled task.

    Now the big unknown is
    a. getting the scheduled task triggered
    b. getting a sound played - when you're not logged on

    For this, vlc player may not be a good choice- I don't know.

    And the first problem I note is that despite research above, I don't see event id 4625 generated... so more research..
    Last edited by dalchina; 27 Sep 2018 at 01:08.
      My Computers


  7. Posts : 42,961
    Win 10 Pro (22H2) (2nd PC is 22H2)
       #7

    Success. That is, I got a sound a few seconds after entering an incorrect password.

    (I also got the sound once after logging on, so needs a little tweak of some kind like testing if logged in or not- doesn't seem possible just using the task scheduler. Can be done using Autohotkey to create a simple script, rather than a bat file. Maybe there's a way using a bat file).

    Investigation, using Fulleventlogview by NirSofer, showed the eventid needed on wrong password entry is 2

    I created a bat file, choosing to use a simple command line player called 'sounder' which I downloaded.
    sounder.exe - play a wav file from the command line

    I created a bat file:
    "E:\User folders\Desktop\sounder.exe" "E:\My sounds\alert.wav"
    (here I put sounder.exe on my desktop, just for demo purposes, and used an existing wav file).

    I created a task, using info from Fulleventlogview that told me from which source I needed to monitor logs
    How can I play a wav sound for a bad password entered at windows logon-1.jpg

    Event: (takes a while to open, long tree to navigate, pick just one)
    How can I play a wav sound for a bad password entered at windows logon-3.jpg

    Action: (the bat file is on my desktop for demo purposes)
    How can I play a wav sound for a bad password entered at windows logon-2.jpg

    General:
    How can I play a wav sound for a bad password entered at windows logon-4.jpg
    Last edited by dalchina; 27 Sep 2018 at 02:45.
      My Computers


  8. Posts : 8
    Windows 10, 64
    Thread Starter
       #8

    Followed your recommendation creating a task.

    then created a batch file with following lines:
    ==========================================
    start wmplayer.exe /play /close c:\windows\media\wrongpass.wav
    timeout 3
    TaskKill.exe /IM WMPlayer.exe
    =============================================
    The batch file plays with no issue, but it won't play the sound when the end-user types the wrong password at the windows logon screen.

    Thanks..
      My Computer


  9. Posts : 42,961
    Win 10 Pro (22H2) (2nd PC is 22H2)
       #9

    Ok, basic check: does the sound play if you open the task scheduler and rt click the task and run it?

    To help with debugging, try adding a line like this to check if the task runs when logged off:
    echo I ran >> "<your path>\pwdalertresult.txt"

    - this creates a file (just different to playing a sound in case that's a problem for some reason). If the file is created, the task has been executed.

    Make sure you have the task trigger conditions right, including run whether logged in or not.

    This is purely experimental - no guarantees. I found sometimes it does, sometimes it doesn't.
      My Computers


  10. Posts : 8
    Windows 10, 64
    Thread Starter
       #10

    It worked with this PowerShell Script.

    -c (New-Object Media.SoundPlayer 'C:\Windows\Media\magic_word.wav').PlaySync();

    How can I play a wav sound for a bad password entered at windows logon-basdpass.jpg
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 12:06.
Find Us




Windows 10 Forums