New
#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
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
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)
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.
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:
- 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.
- your script runs in double-click, runs in CMD, runs in manual Task Scheduler, but not in auto.
- 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 - - -
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.
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?
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!
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]
Good news!
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
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).