Solved

Printbrm.exe - backup printer objects, print drivers and printer ports

Posted on 2014-03-05
9
1,527 Views
Last Modified: 2014-03-06
Hi

I am having problem to execute this batch file on Win2008 R 64bit
Basically, i am getting this error

C:\Users\xxxxx\Desktop>Printbrm.cmd
'"C:\Windows\System32\Spool\Tools\PrintBRM -B -S"' is not recognized as an inter
nal or external command,
operable program or batch file.
'"C:\Windows\System32\Spool\Tools\PrintBRM -B -S"' is not recognized as an inter
nal or external command,
operable program or batch file.
'"C:\Windows\System32\Spool\Tools\PrintBRM -B -S"' is not recognized as an inter
nal or external command,
operable program or batch file.


I am not sure what i am doing wrong or what is wrong with this batch script

What i want to accomplished is to pull printers objects, printer drives and printer ports from remove print server and copy to centralize server?

Can some help me out?
printbrm.cmd
0
Comment
Question by:michalek19
  • 5
  • 4
9 Comments
 
LVL 19

Expert Comment

by:marsilies
ID: 39909407
You don't need the quotation marks in your command. The batch is trying to run the command:
"C:\Windows\System32\Spool\Tools\PrintBRM -B -S"
Instead of running:
C:\Windows\System32\Spool\Tools\PrintBRM -B -S

If any of your paths had spaces or special characters in them, you'd have to deal with quotes, but it looks like you don't.
http://stackoverflow.com/questions/535975/dealing-with-quotes-in-windows-batch-scripts

Also, you doubled up the -b and -s switches, putting them both in the "PrintBRM" variable you set and the actual command.
0
 

Author Comment

by:michalek19
ID: 39909475
I am sorry, can you point me what quotation marks are you revering to

@echo off
set BkupDir=C:\temp
set PrintBRM=%windir%\System32\Spool\Tools\PrintBRM -B -S

call :DoBackup PRINT-fs2
call :DoBackup PRINT-fs3
call :DoBackup PRINT-f4
goto :EOF

:DoBackup [printservername]
  if exist "%BkupDir%\%~1.printerExport" ren "%BkupDir%\%~1.printerExport" "*.bak"
  "%PrintBRM%" -s \\%~1 -b -f "%BkupDir%\%~1.printerExport" -O FORCE && (
    if exist "%BkupDir%\%~1.bak" del "%BkupDir%\%~1.bak"
  ) || (
    if exist "%BkupDir%\%~1.bak" ren "%BkupDir%\%~1.bak" "*.printerExport"
  )
  goto :EOF
0
 
LVL 19

Expert Comment

by:marsilies
ID: 39909574
set PrintBRM=%windir%\System32\Spool\Tools\PrintBRM -B -S

Should be:
set PrintBRM=%windir%\System32\Spool\Tools\PrintBRM


And
"%PrintBRM%" -s \\%~1 -b -f "%BkupDir%\%~1.printerExport" -O FORCE

Should be
%PrintBRM% -b -s \\%~1 -f %BkupDir%\%~1.printerExport -O FORCE
0
 

Author Comment

by:michalek19
ID: 39909792
I changed it to
@echo off
set BkupDir=C:\temp
set PrintBRM=%windir%\System32\Spool\Tools\PrintBRM

call :DoBackup YN-CORPNT1
call :DoBackup BO-CORP1
call :DoBackup CI-CORPNT1
goto :EOF

:DoBackup [printservername]
  if exist "%BkupDir%\%~1.printerExport" ren "%BkupDir%\%~1.printerExport" "*.bak"
  "%PrintBRM% -b -s \\%~1 -f %BkupDir%\%~1.printerExport -O FORCE && (
    if exist "%BkupDir%\%~1.bak" del "%BkupDir%\%~1.bak"
  ) || (
    if exist "%BkupDir%\%~1.bak" ren "%BkupDir%\%~1.bak" "*.printerExport"
  )
  goto :EOF



but i got output as follow


C:\Printbrm.cmd
The filename, directory name, or volume label syntax is incorrect.
The filename, directory name, or volume label syntax is incorrect.
The filename, directory name, or volume label syntax is incorrect.
0
Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 
LVL 19

Accepted Solution

by:
marsilies earned 355 total points
ID: 39909843
You still have a quotation mark before %PrintBRM%
0
 

Author Comment

by:michalek19
ID: 39910569
Is it possible to add to this batch script log files of the  backed up printer objects?
and received an e-mail when the backup up is completed.
0
 
LVL 19

Expert Comment

by:marsilies
ID: 39910586
It might be possible, but that's outside the scope of your original question. You should open up a new question to ask about adding those features to the batch file.
0
 

Author Comment

by:michalek19
ID: 39910636
I've requested that this question be closed as follows:

Accepted answer: 0 points for michalek19's comment #a39909792

for the following reason:

Great support

I will open another ticket other question
0
 

Author Comment

by:michalek19
ID: 39910655
New topic

Printbrm.exe - adding log file and e-mail alert to batch file
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The article will show you how you can maintain a simple logfile of all Startup and Shutdown events on Windows servers and desktops with PowerShell. The script can be easily adapted into doing more like gracefully silencing/updating your monitoring s…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now