Windows – .vbs won’t execute anything at all

batchvbscriptwindowswindows server 2008

I created short script to run .bat file on background but when i execute .vbs file, it seems like it is not reading my script at all.
.Dos windows pops up and shutdown right away but my batch file is never executed.
(when i execute batch file directly, it works fine, so I'm assuming this script is the problem)

Dim sCurPath
sCurPath = CreateObject("Scripting.FileSystemObject").GetAbsolutePathName(".")
Set WshShell = CreateObject("WScript.Shell")
cmds=WshShell.RUN(sCurPath & "\myrun.bat", 0, True)

This code works on my desktop, windows 7 32 bit but when i try to execute this script on windows server 2008 R2, it won't do anything.
Does anyone know what I need to do to run this .vbs script on windows server?

Best Answer

Most admins disable WSH on Windows Server

Verify the entry values located below are set to 1 (enabled):

User:

HKCU\Software\Microsoft\Windows Script Host\Settings\Enabled

Machine:

HKLM\Software\Microsoft\Windows Script Host\Settings\Enabled

TechNet article

Related Question