Question

This is my script.

@echo off

set USER = %1

if [%1]==[] goto error

icacls \\TESTSERVER\testusers\%user% /grant:r "%USER%":(OI)(CI)F

icacls d:\testusers\%user% /grant:r "%USER%":(OI)(CI)F

@echo Folder Permission set successfully

goto end

:error

 @echo Error 101- Username Parameter invalid-Please provide a valid username as Parameter

:end

And this is the output:

processed file: \\TESTSERVER\testusers\
Successfully processed 1 files; Failed processing 0 files
processed file: d:\testusers\
Successfully processed 1 files; Failed processing 0 files
Folder Permission set successfully

Instead of applying permissions to folder specified by user, the script is applying permission to parent folder.

also when I see the security tab of testuser folder instead of user name I find some account name S-1-5-21-710178827-4191585984.....

What am I doing wrong.

Was it helpful?

Solution

There is a space in your set user= statement. This sets a variable "User " not "USER"

Spaces are significant on each side of = in a string set.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top