Computing.Net > Forums > Programming > psexec error when launching .cmd

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

psexec error when launching .cmd

Reply to Message Icon

Name: paultown
Date: November 7, 2004 at 19:15:35 Pacific
OS: WIN NT4
CPU/Ram: Pentium 4 1.2Ghz 512MG RA
Comment:

I have created the following batch file that automatically creates a file call printer.vbs on a remote system, but when I try to get psexec to lauch the file I get an error "The system cannot find the file specified."
The file is defidently there and can't understand why it can't be launched.
I tried a variation by getting the batch file to create another batch file that calls for printer.vbs but got the same error.
The code is as follows:-


@echo off
cls
echo Add Printer %2 on %1
echo ____________________________________________
echo.

if {%1}=={} goto HowTo
if {%2}=={} goto HowTo

CALL
>>\\%1\C$\WINNT\system32\printer1.cmd ECHO @echo off
>>\\%1\C$\WINNT\system32\printer1.cmd ECHO start c:\WINNT\system32\printer.vbs
>>\\%1\C$\WINNT\system32\printer1.cmd ECHO goto end
>>\\%1\C$\WINNT\system32\printer1.cmd ECHO :end
>>\\%1\C$\WINNT\system32\printer1.cmd ECHO exit

CALL
>>\\%1\C$\WINNT\system32\printer.vbs E-------------------
>>\\%1\C$\WINNT\system32\printer.vbs ECHO ' Author: Paul Townsend. 21/10/2004
>>\\%1\C$\WINNT\system32\printer.vbs ECHO ' Printer Install for network printer:
>>\\%1\C$\WINNT\system32\printer.vbs ECHO ' %2
>>\\%1\C$\WINNT\system32\printer.vbs E-------------------
>>\\%1\C$\WINNT\system32\printer.vbs ECHO Set WshNetwork = WScript.CreateObject("WScript.Network")
>>\\%1\C$\WINNT\system32\printer.vbs ECHO PrinterPath = "%2"
>>\\%1\C$\WINNT\system32\printer.vbs ECHO WshNetwork.AddWindowsPrinterConnection PrinterPath
>>\\%1\C$\WINNT\system32\printer.vbs ECHO WScript.quit

Call Wait 10
psexec \\%1 -u localadmin -p Password cscript.exe -i \\%1\C$\WINNT\system32\printer.vbs


echo Printer %2 has been successfully added on %1.

Goto End

:HowTo
echo Adds a printer on the target workstation
echo.
echo Usage: Printer [Computername] [\\Server\Printer]
echo.

:End
pause

I added the call wait 10 line just to make sure the file did get created before psexec tried to launch it, but still failed.
I get the following error in the command prompt:-

PsExec v1.42 - execute processes remotely
Copyright (C) 2001-2003 Mark Russinovich
www.sysinternals.com


Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

\\wau34420180\C$\WINNT\system32\printer.vbs(8, 1) (null): The system cannot find
the file specified.

cscript.exe exited on wau34420180 with error code 0.

Any ideas?
Anyone have any thoughts as to why psexec can't find the file?
Thanks in advance



Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: psexec error when launching .cmd

error when loading word documents www.computing.net/answers/programming/error-when-loading-word-documents/5126.html

Error when i trying install VS.NET www.computing.net/answers/programming/error-when-i-trying-install-vsnet/9790.html

Error when compiling java files!!? www.computing.net/answers/programming/error-when-compiling-java-files/11054.html