Is there a way, within a batch file, to log the error and success of the batch file?
I am trying to copy a file from my computer to 200 machines (works great) but wa
This is simple logging - just checks if the drive was mapped and if the filename appears on the mapped drive, and writes the log to your desktop.
@echo off
if [%1]==[] goto usage
echo mapping l: to %1\c$
net use * /delete /y
net use l: \\%1\c$ password /user:%1\administrator
if not exist L:\ (echo %1 failed mapping drive letter>>"%userprofile%\desktop\net use log.txt"& goto :EOF)
echo copying link file to C: Drive
copy "c:\_\CopyFileToHost\logoff.cmd" l:\
if not exist "L:\logoff.cmd" (echo %1 failed copying "c:\_\CopyFileToHost\logoff.cmd">>"%userprofile%\desktop\net use log.txt")
echo deleting l: mapping
net use l: /delete /y
goto :eof
:usage
echo Usage: %0 hostname
exit /B 1