Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
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 HowToCALL
>>\\%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 exitCALL
>>\\%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.quitCall 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
pauseI 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

![]() |
![]() |
![]() |

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