How to Play Sound at Logoff (Sign-out) in Windows 10  

Page 2 of 2 FirstFirst 12

  1. Posts : 7,607
    Windows 10 Home 20H2
       #10

    Use only the following line in your VBScript file:

    Code:
    CreateObject("wscript.shell").Run("PowerShell (New-Object Media.SoundPlayer 'D:\Music\SystemSounds\SystemDown_Ivy.wav').PlaySync()"),0
      My Computer


  2. Posts : 96
    w10 pro64
       #11

    still negative...
    New script works ok (double-click, and you hear the sound).
    Entries in Task Scheduler as discussed.

    - - - Updated - - -

    Event ID 4647 is logged in EventViewer\Windows Logs\Security.

    User initiated logoff:

    Subject:
    Security ID: LAPTOP-xxxxxxxxxxxxx
    Account Name: xxxxxxxxxxxxxxx
    Account Domain: LAPTOP-xxxxxxxxxxxxx
    Logon ID: 0x34F81

    This event is generated when a logoff is initiated. No further user-initiated activity can occur. This event can be interpreted as a logoff event.

    - - - Updated - - -

    Task Scheduler, under "Last Run Result", reports:
    A system shutdown is in progress (0x8007045B)
      My Computers


  3. Posts : 7,607
    Windows 10 Home 20H2
       #12

    abax2000 said:
    wscript.exe is present in windows\system32
    Try using the following full path in Task Scheduler:

    %WinDir%\System32\wscript.exe

    Manually run the task. See whether it works.


    Try the following line of commands on Command Prompt:

    %WinDir%\System32\wscript.exe "C:\Desktop\LogOutSound.vbs"
      My Computer


  4. Posts : 96
    w10 pro64
       #13

    I had to change arguments (path) into:
    "C:\Users\xxxxxx\Desktop\LogOutSound.vbs"
    Following that, CMD is successful; and manually running the task is also successful.

    But it does not work at shutdown (or restart).
    I always get:
    event ID 203, Action failed to start, error value 2147943515 (aka system shutdown is in progress)
    event ID 101, Task start failed, same error value.

    Changed user account into SYSTEM, with exactly the same results.

    PS: usual system shutdown (before and during this quest) is NOT exactly at lightning speed; appr. 9 sec.
      My Computers


  5. Posts : 7,607
    Windows 10 Home 20H2
       #14

    abax2000 said:
    But it does not work at shutdown (or restart).
    I always get:
    event ID 203, Action failed to start, error value 2147943515 (aka system shutdown is in progress)
    event ID 101, Task start failed, same error value.
    In this tutorial, Event ID 4647 is used, and it works perfectly at my end as shown below:

    How to Play Sound at Logoff (Sign-out) in Windows 10-event-id-4647.jpg

    How to Play Sound at Logoff (Sign-out) in Windows 10-successful.jpg

    abax2000 said:
    Task Scheduler, under "Last Run Result", reports:
    A system shutdown is in progress (0x8007045B)
    Manually sign out, and check the "Last Run Result" again.
      My Computer


  6. Posts : 96
    w10 pro64
       #15

    Hi Matthew and thnx for still being around,

    it doesn't want to go down easy...
    BUT, I managed to get it going in Local Group Policy (User Configuration\Windows Settings\Scripts\Logoff... hallelujah.
    Thanks to this Back to Basics: Windows Shutdown Autostart explained - gHacks Tech News.
    For some other crazy reasons, this same method does not work for startup sound (in computer configuration\windows settings\scripts\startup - did not test the logon method). So, I used Winaero to make it happen for startup (changing the default sound with my own).

    Other crazy findings:
    1. the original script I was using, runs on double-click, runs in CMD, does not run in manual Task Sceduler, and of course not in auto Task Sceduler.
    2. your script runs in double-click, runs in CMD, runs in manual Task Scheduler, but not in auto.

    1. The "revived" Windows logon/logout sounds, that can be brought back in Sounds settings with registry edit (as described at the bottom of this How to Change the Windows 10 Startup Sound) do not work. You get the settings back, you can assign sounds, but they do not play.


    - - - Updated - - -

    Matthew Wai said:
    In this tutorial, Event ID 4647 is used, and it works perfectly at my end as shown below:

    How to Play Sound at Logoff (Sign-out) in Windows 10-event-id-4647.jpg

    How to Play Sound at Logoff (Sign-out) in Windows 10-successful.jpg

    Manually sign out, and check the "Last Run Result" again.
    Many retries by now (sign-outs, restarts, full shutdowns),,,no difference.
    Event ID 4647 is recorded normally.
    I have totally run out of ideas what can be the root cause of the different behaviour.
      My Computers


  7. Posts : 7,607
    Windows 10 Home 20H2
       #16

    abax2000 said:
    Task Scheduler, under "Last Run Result", reports:A system shutdown is in progress (0x8007045B)
    I shut down Windows previously. Now I have the same "Last Run Result"—(0x8007045B). That is normal.
    However, when I manually sign out, the "Last Run Result" is "The operation completed successfully".
    Can you manually sign out, take a screenshot of the "Last Run Result", and post it here?

    abax2000 said:
    your script runs in double-click, runs in CMD
    When you double-click on my VBScript file, it will be run via WScript.exe rather than CMD.
    My VBScript file has nothing to do with CMD.

    BTW, thanks for your beer!
      My Computer


  8. Posts : 96
    w10 pro64
       #17

    Manual logoff (and using the script you proposed) works. Task is completed successfully and we have sound. "Last Run Result" exactly like yours.
    But, itt still does not work on shutdown or restart.
    [when i use the original script, even logoff does not work - dont know why. Task is triggered, creates task process, starts task, starts action, BUT no action completed, no task completed.]

    As for your second point, I was referring to this:
    [quote]
    Try the following line of commands on Command Prompt:
    %WinDir%\System32\wscript.exe "C:\Desktop\LogOutSound.vbs"
    [unquote]
      My Computers


  9. Posts : 7,607
    Windows 10 Home 20H2
       #18

    abax2000 said:
    Manual logoff (and using the script you proposed) works. Task is completed successfully and we have sound. "Last Run Result" exactly like yours.
    Good news!

    abax2000 said:
    But, itt still does not work on shutdown or restart.
    Look at the tutorial title "How to Play Sound at Logoff (Sign-out)".
    This tutorial does not deal with shutdowns or restart. The following does.

    Play Sound at Shutdown in Windows 10
      My Computer


  10. Posts : 96
    w10 pro64
       #19

    Logoff takes place anyhow at shutdown or restart. And event ID 4647 is recorded in all cases.
    So, I assume that it would work regardless (and to be honest, I do not understand why it is not working).

    Anyhow, Group Policy looks more "straightforward" solution (at least for Pro and Corporate editions). I will stick to that.
    And at some point, I will try again to get the startup sound there (instead of Winaero).
      My Computers


 

Tutorial Categories

How to Play Sound at Logoff (Sign-out) in Windows 10 Tutorial Index Network & Sharing Instalation and Upgrade Browsers and Email General Tips Gaming Customization Apps and Features Virtualization BSOD System Security User Accounts Hardware and Drivers Updates and Activation Backup and Restore Performance and Maintenance Mixed Reality Phone


  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 02:21.
Find Us




Windows 10 Forums