Page 1 of 1

SetACL error

Posted: 12 Aug 2022 12:20
by Docfxit
I have a batch file that I'm trying to create and I'm getting an error:
This is the error:

Code: Select all

C:\Batch>"C:\Batch\SetACL.exe" -on C:\Windows\system32\spool\Printers -ot file -actn ace "n:Gary;p:full"
ERROR in command line: No parameter found for option n:Gary;p:full!
This is the bat file:

Code: Select all

	net stop spooler
		@Echo off
		If not exist "%~d0\Batch\SetACL.exe" (
			cls
			Echo.
			Echo.
			Echo              %~d0Batch\SetACL.exe Not Found!!!
			Echo.
			Echo              Please get SetACL.exe and restart this file.
			Echo.
			Pause
			exit
			)
			@Echo On
			set folder=%WINDIR%\system32\spool\Printers
		"%~d0\Batch\SetACL.exe" -on %folder% -ot file -actn ace "n:%username%;p:full"
		del /F /q  %WINDIR%\system32\spool\PRINTERS\*.*
		net start spooler
pause		
Can someone please help fix this error?

Thank you,
Docfxit

Re: SetACL error

Posted: 12 Aug 2022 14:26
by aGerman
The manpage states
[...] file or directory (file) [...]
There's no folder object type.

Steffen

Re: SetACL error

Posted: 12 Aug 2022 15:59
by Docfxit
Great catch. Thank you very much for pointing that out to me.

I have changed it from Folder to File.

I'm now getting a new error:

Code: Select all

C:\Batch>"C:\Batch\SetACL.exe" -on C:\Windows\system32\spool\Printers -ot file -actn ace "n:Gary;p:full"
ERROR in command line: No parameter found for option n:Gary;p:full!
I don't understand what parameter it's looking for.

Re: SetACL error

Posted: 12 Aug 2022 16:20
by Docfxit
I was able to get it to run but I don't understand why.
I had:

Code: Select all

SetACL.exe" -on %folder% -ot file -actn ace "n:%username%;p:full"
I added -ace:

Code: Select all

SetACL.exe" -on %folder% -ot file -actn ace -ace "n:%username%;p:full"
I have no idea what "-ace" means.
It does work now.

Re: SetACL error

Posted: 12 Aug 2022 17:09
by aGerman
Docfxit wrote:
12 Aug 2022 16:20
I have no idea what "-ace" means.
This is all perfectly explained. Read it as -parameterName value pairs.
-actn ace is parameter action with access control entry as the belonging value, telling SetACL what's to be updated.
-ace "n:%username%;p:full" is parameter access control entry with user name and kind of access to be granted as the belonging value.
This is just how the developer of the tool specified the syntax.

Steffen

Re: SetACL error

Posted: 13 Aug 2022 17:43
by Docfxit
Thank you very much for the explanation.

It's working great now.