title: PrintBRM Permission Issue When Exporting Printers
body: <p>When using Window's Printbrm tool to export printers to a directory on a server, I get the export but no longer have read permissions for the .printerexport.</p>
  
  <p>The code I am using runs on the server (in a batch file) where the printer export will be stored. Running the bat file from the server correctly gives me read permissions when exporting locally. The issue appears when running the bat file from the server exporting to the same server. The bat file is run on the local admin account and server is connected to via domain user.</p>
  
  <p>Batch file to export:</p>
  
  <pre><code>rem Connect to server
  set /p u=Username:
  net use \\servername\dir /user:domain\%u% * /persistent:no
  
  rem Use pushd because printbrm does not support spaces in path name
  pushd \\servername\dir
  
  C:\Windows\System32\spool\tools\PrintBrm.exe -b -f %computername%.printerexport -o force
  
  popd
  </code></pre>
  
  <p>Batch file to reimport:</p>
  
  <pre><code>rem Connect to server
  set /p u=Username:
  net use \\servername\dir /user:domain\%u% * /persistent:no
  
  rem Use pushd because printbrm does not support spaces in path name
  pushd \\servername\dir
  
  C:\Windows\System32\spool\tools\PrintBrm.exe -r -f %computername%.printerexport -o force
  
  popd
  </code></pre>
  
  <p>Printer export file is created successfully. When running the batch file to reimport, I get:</p>
  
  <pre><code>Operation mode: restore
  Target server: local machine
  Target file path: \\servername\dir\%computername%.printerexport.
  Queue publish mode: none
  Overwrite mode: keep existing settings
  Queue ACL mode: restore ACLs from backup
  The following error occurred: 0x80070002.
  The system cannot find the file specified.
  </code></pre>
  
  <p>Checking the %computername%.printerexport properties>Security, I get a message:</p>
  
  <pre><code>You must have Read permissions to view the properties of this object.
  </code></pre>
  
  <p>When executed correctly, I should be able to export all the printers/queues/drivers/etc, and reimport them.</p>