Jump to content

Scan.vbs(2, 1) (null): The system cannot find the file specified. Locally, works fine though

Recommended Posts

I have two .vbs files: test.vbs and scan.vbs. The two work fine when executed locally on a PC. It it when I try to execute them remotely via psexec that the scan.vbs gives me the following error on the remote PC:




cscript.exe //Nologo "C:\Program Files (x86)\Common Files\Intuit\QuickBooks\scan.vbs"

C:\Program Files (x86)\Common Files\Intuit\QuickBooks\scan.vbs(2, 1) (null): The system cannot find the file specified.

I should note that I'm running a batch file that then executes the vbs file. Both batch files also work fine locally. Each batch file has only one command:


cscript //Nologo "C:\Program Files (x86)\Common Files\Intuit\QuickBooks\scan.vbs"


cscript //Nologo "C:\Program Files (x86)\Common Files\Intuit\QuickBooks\test.vbs"

Here is the script for scan.vbs (Works only locally):

Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run "QBServerUtilityMgr.exe"
Wscript.Sleep 5000
objShell.AppActivate "QBServerUtilityMgr"
objShell.SendKeys "{TAB}"
objShell.SendKeys "{ENTER}"

When ran remotely, line 2, objShell.Run "QBServerUtilityMgr.exe" is the line I assume it is complaining about and that it cannot find.

The test.vbs runs without any errors, locally and remotely, so I'm curious what the difference is between the two files that would allow one to work both locally and remotely, while the other (scan.vbs) only appears to work locally?

Here is the script for test.vbs (works both locally and remotely):

Option Explicit
Dim objFSO, objFSOText, objFolder, objFile
Dim strDirectory, strFile
strDirectory = "C:\VBScripts\"
strFile = "\Summer.txt"

' Create the File System Object
Set objFSO = CreateObject("Scripting.FileSystemObject")

' Create the Folder specified by strDirectory on line 10
Set objFolder = objFSO.CreateFolder(strDirectory)

' -- The heart of the create file script
'Creates the file using the value of strFile on Line 11
' -----------------------------------------------
Set objFile = objFSO.CreateTextFile(strDirectory & strFile)
Wscript.Echo "Just created " & strDirectory & strFile


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...