maxwsp
asked on
Batch Script runs with errors PrintBRM
Hello,
I am currently running this scheduled Batch file command to backup Printer Confgiuration :
del c:\temp\printersbackupconf ig\*.* /S/Q
%windir%\System32\Spool\To ols\PrintB RM -s \\printserver1 -b -f c:\temp\printersbackupconf ig\printse rver1.prin terExport -O FORCE
The script runs with no issues as a scedule task every week but what I was hoping to do is alter the script so it does not delete the folder items (time consuming many print server configs) and can backup the latest printer settings sucesssfully.
If I do not use del c:\temp\printersbackupconf ig\*.* /S/Q then the script comes up with error messages in msdos:
Operation mode: backup
Target server: \\printserver1
Target file path: c:\temp\printersbackupconf ig\printse rver1.prin terExport.
Queue publish mode: none
Overwrite mode: force new settings
LISTING PRINT QUEUES
..
..
The following error occurred: 0x80070050.
The file exists.
Is there any way of not using the del c:\temp\printersbackupconf ig\*.* /S/Q and overwite what currently in the location without error "The File exists"
Cheers
Max-IT
I am currently running this scheduled Batch file command to backup Printer Confgiuration :
del c:\temp\printersbackupconf
%windir%\System32\Spool\To
The script runs with no issues as a scedule task every week but what I was hoping to do is alter the script so it does not delete the folder items (time consuming many print server configs) and can backup the latest printer settings sucesssfully.
If I do not use del c:\temp\printersbackupconf
Operation mode: backup
Target server: \\printserver1
Target file path: c:\temp\printersbackupconf
Queue publish mode: none
Overwrite mode: force new settings
LISTING PRINT QUEUES
..
..
The following error occurred: 0x80070050.
The file exists.
Is there any way of not using the del c:\temp\printersbackupconf
Cheers
Max-IT
I was already to suggest just deleting the single file, and refreshed and viola, Steve was there with it. So I would recommend that as the first and simplest approach to consider as well.
~bp
~bp
ASKER
Thanks for comments - the idea behind not deleting the file before another fresh backup runs is the fact that the script runs weekly and if say there is an issue with the backup then not only the previous backup is deleted but no backup as well. I was just wondeing whether I could overwrite the file(s) rather than moving or deleting the file as space is also an issue in our environment. Also it's not just a single file but the batch file actually is used to backup over 20 print servers ad size of these do grow - so do not want to move files to a temporary location and rather have an option to overwrite current files.
Cheers
Max-IT
Cheers
Max-IT
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for the code - this should do the trick.
c:\temp\printersbackupconf
or export it into a temporary directory then move / copy it to the one you want.
e.g.
rd C:\temp\tempexport /s/q
md c:\temp\tempexport
%windir%\System32\Spool\To
move c:\temp\tempexport\printse
or something like that!
Steve