none
OK icacls command that should work but doesn't.

    Question

  • icacls "c:\windows\system32\spool\PRINTERS" /grant administrators:(IO)(CI)(OI)F /t 

    When some of my systems go to print a PDF the spooler just locks up.  I can't control what type of PDF files are coming in as they are made by all kinds of software and so the problems begin.  I have been working on a batch file that will stop the spooler service if it hasn't already, then run the above command to grant rights to the indicated directory so that the offending files can be deleted from the spooler and restart the spooler service after that has happened.  The reason for this is that by default a user can't go in and delete the files.  I believe that I have the command correct and it used to work fine in Windows XP and Windows 7 but I can't see why it doesn't work in Windows 8. 

    Here is the batch file.  Please tell me what I have wrong in it.

    net stop spooler
    timeout/t 3 /nobreak
    icacls "c:\windows\system32\spool\PRINTERS" /grant administrators:(IO)(CI)(OI)F /t
    c:
    cd\windows\system32\spool\PRINTERS
    Del *.s*
    timeout/t 3
    net start spooler
    exit 

    Tuesday, July 15, 2014 9:31 PM

All replies

  • If you run icacls "c:\windows\system32\spool\PRINTERS" /grant administrators:(IO)(CI)(OI)F /t manually, what output do you get and what is the resultant ACL on the files?

    Also, you shouldn't use the /t switch - it tells icacls to recursively apply that ACE for every subitem in that folder rather than let NTFS handle it via inheritance. The only time you should use it is when you really need to apply a specific ACE explicitly to all items in a folder, for instance: 

    icacls "C:\temp" /grant administrators:F /t

    The above command will explicitly grant Administrators full control on every item in that folder (this item only - no inheritance).

    Wednesday, July 16, 2014 7:47 AM
  • Hi,

    Do you have any progresses on this issue by now?

    Please feel free to let us know if this issue persists.

    Best Regards,

    Amy
    Wednesday, July 23, 2014 2:58 AM
    Moderator
  • I'll be able to sit down and go over it next week.  I just forced it. I need to get this batch file fixed so that it always works.  
    • Edited by dxmage Friday, July 25, 2014 12:53 PM
    Thursday, July 24, 2014 4:01 PM