03 December 2011

Solution for the VBscript Engine Not found Error(Customizing Desktop)

Guys,
Some of our guys experienced an error while trying to shutdown from the shutdown button on the customized desktop. 


Usually some Antivirus vendors replace the original VBscript dll to ensure no bad scripts should be executed on the computer. There is some tweaks to re-enable VBscript engine, you can find it in google. But I don't recommend that because it may make your computer vulnerable. If you still want to do it, please go to bottom of this post.
       So, I came up with another alternative solution which we can use bat files to do the shutdown, logoff and restart. I already explained how to make such bat files on my post about Shutdown your PC remotely using Email / Mobile. However  I'll give you the step by step instruction.


01. 
      A. Create a text file and type "shutdown.exe -s -t 00" without quotes and     save it as shut.bat(change .txt to .bat)
      B. Create a text file and type "shutdown.exe -r -t 00" without quotes and save  it as res.bat(change .txt to .bat)

      C. Create a text file and type "shutdown.exe -l -t 00" without quotes and save it as log.bat(change .txt to .bat)


02. Navigate to Documents/Rainmeter folder and create a new folder named Scripts, then copy all three bat files to that folder.
Note down the file paths (eg: C:\users\Admin\Documents\Rainmeter\Scripts)


03. Right Click on the shutdown button on your desktop, then click edit skin.

04. Find the following Code snippet 


     [Logoff]
     Meter=Image
     ImageName=Connectiions.png
     X=30
     Y=47
     LeftMouseDownAction=!Execute ["#SystemPath#wscript.exe" 
     "#CurrentPath#SysTray.vbs"]
    and replace the part ["#SystemPath#wscript.exe" 
     "#CurrentPath#SysTray.vbs"] with ["C:\Users\ADMIN\Documents\Rainmeter\Scripts\log.bat"] (Remember this path must be the path you placed your bat files. My account name is ADMIN so it came as ["C:\Users\ADMIN\Documents\Rainmeter\Scripts\log.bat"], but it may differ in your case.

04. Do the same for [Shutdown] and [Restart] snippets too.. Remember to give the correct bat file, for shutdown shut.bat and Restart res.bat.

05. Click Save and close.

06. Right Click the shutdown button and click refresh skin. That's it. You are done..


Enabling VB Script Engine:

1. try to register vbscript dll 
    Open a command prompt as Administrator and type "regsvr32 vbscript.dll"
2. If registering didn't solve the issue, probably your Antivirus vendor has changed the registry value

 If your vbscript dll was disabled by your antivirus, you can enable it by editing the registry key. In my case, McAfee antivirus changed the registry as follows.



HKEY_LOCAL_MACHINE \ SOFTWARE \ Classes \ CLSID \ {B54F3741-5B07-11cf-A4B0-00AA004A55E8} \ InprocServer32]
@ = "C: \ \ Program Files \ \ Common Files \ \ McAfee \ \ SystemCore \ \ ScriptSn.20101116171926.dll"
"ThreadingModel" = "Both"

 So, I changed it back to

[HKEY_LOCAL_MACHINE \ SOFTWARE \ Classes \ CLSID \ {B54F3741-5B07-11cf-A4B0-00AA004A55E8} \ InprocServer32]
@ = "C: \ \ Windows \ \ System32 \ \ vbscript.dll"
"ThreadingModel" = "Both" 

Note: In a 64 bit machine, the path will be

HKEY_LOCAL_MACHINE \SOFTWARE\Wow6432Node\Classes\CLSID\{B54F3741-5B07-11cf-A4B0-00AA004A55E8}\InprocServer32