wscript.exe stopped working with a custom protocol

半腔热情 提交于 2020-01-24 22:04:51

问题


All the computers in our company are configured with a custom protocol that runs a vbs script, so when you click on a link with that user protocol, the vbs script starts and performs operations that interact with the file system and applications otherwise inaccessible to the browser.

This is the .reg file used to register the protocol:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\<name>]
"URL Protocol"=""
@="Url:<Description>"
"UseOriginalUrlEncoding"=dword:00000001

[HKEY_CLASSES_ROOT\<name>\DefaultIcon]
@="C:\\Windows\\System32\\WScript.exe"

[HKEY_CLASSES_ROOT\<name>\shell]

[HKEY_CLASSES_ROOT\<name>\shell\open]

[HKEY_CLASSES_ROOT\<name>\shell\open\command]
@="C:\\Windows\\System32\\WScript.exe \"C:\\Program Files\\<name>.vbs\" \"%1\""

The script has worked beautifully since 2014 without problems on ~50 computers.

Last week one user complained that it stopped working. I found out that WScript.exe doesn't work anymore, so I copied it creating WScript2.exe, modified the custom protocol to run WScript2.exe and it restarted working.

This morning also my computer didn't listen to the clicks on my custom protocol. I made a copy of WScript.exe to WScript2.exe and it restarted working.

I am expecting my phone to start ringing soon.

Why did WScript.exe stop listening to the custom protocol?

Why its identical copy still works?

EDIT (answers to comments)

Perhaps if I knew how to better describe "it stopped working" then I would know how to fix it :)

I don't know if it stopped working because of a Microsoft update, an anti-virus update or a change on the IT infrastructure/configuration. Here is a quick summary of what led me to the workaround:

  • I compared my custom protocol to a working one, I picked mailto as a reference
  • I noticed that changing the last line of the .reg file (see above) it would work with any other executable, but it wouldn't work with wscript.exe
  • I compared the execution of wscript.exe on the affected computers to its execution on computers (not yet) affected and there is no difference
    • A double click shows the same Windows Script Host Settings dialog
    • The execution from a command prompt with the same arguments used by the custom protocol works as expected
  • The custom protocol passes the correct arguments when executing another executable
  • At this point I thought that Windows blacklisted wscript.exe and I started searching for an alternative
  • I tried to rename wscript.exe to wscript2.exe but I couldn't because I don't have TrustedInstaller permission
  • I made a copy instead of renaming it
  • I tested the copy from the command prompt and it was working like the original
  • I tested the copy from the custom protocol and it was working like the original once did

EDIT 2 (more answers to comments)

All the computers have Windows 10 Pro.

Clicking on Settings - Updates & Security - View update history it says Feature update to Windows 10, version 1803 Succesfully installed on 5/22/2018. Clicking on Show what's new in this update shows nothing useful.

EDIT 3

Doesn't work = no symptoms, nothing happens, nothing is executed, nothing is logged (as far as I know).

I tried with a simple vbscript with a single line MsgBox "Hello". It works running it from the command line, but it doesn't work from the custom protocol. The task manager doesn't show anything popping up, but I don't know if it doesn't show it because the lifespan is too short to show or because it doesn't execute. The same script works with wscript2.exe.

My feeling is that something (Windows, anti-virus, ...) is blacklisting the custom protocol + wscript.exe thing, but not the custom protocol + any other executable or any other environment + wscript.exe. That's why I tried to copy wscript.exe to wscript2.exe. And I was pleasantly surprised to find out that it works.

来源:https://stackoverflow.com/questions/50533028/wscript-exe-stopped-working-with-a-custom-protocol

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!