Search the Community
Showing results for tags 'remotely'.
-
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: batchscan.bat cscript //Nologo "C:\Program Files (x86)\Common Files\Intuit\QuickBooks\scan.vbs" batchtest.bat 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 Wscript.Quit