We help IT Professionals succeed at work.

Script to take ownership of a specific folder in D drive for the logged in user and then add the logged in domain user with full permission both in share and security.

Hi,

Script to take ownership of a specific folder in D drive for the logged in user and then add the logged in domain user with full permission both in share and security.

Can anone help with this
D:\CNN

Regards
Sharath
Comment
Watch Question

Commented:
I have a similar process and use two Microsoft tools for this. My code does not set the share permissions but subinacl can do that for you. I just use a batch file to do this.

Subinacl http://www.microsoft.com/downloads/details.aspx?FamilyID=e8ba3e56-d8fe-4a91-93cf-ed6985e3927b&displaylang=en
xcacls http://www.microsoft.com/downloads/details.aspx?familyid=0ad33a24-0616-473c-b103-c35bc2820bda&displaylang=en
subinacl /folder D:\CNN /setowner=%USERDOMAIN%\%USERNAME%
xcacls D:\CNN /E /G %USERDOMAIN%\%USERNAME%:F /Y

Open in new window

Author

Commented:
I get this

C:\>CNN.bat

C:\>subinacl /folder D:\CNN /setowner=LTH\admin
WARNING : Error parsing line +folder d:\cmsynergy
Use :
SubInacl /help to get the usage information
or
SubInAcl /help syntax to understand SubInAcl syntax.

Elapsed Time: 00 00:00:00
Done:        0, Modified        0, Failed        0, Syntax errors        1
Last Syntax Error:WARNING : Error parsing line +folder d:\cnn

C:\>xcacls D:\CNN /E /G LTH\admin:F /Y

Commented:
sorry typo in the command it should be subinacl /file D:\CNN /setowner=%USERDOMAIN%\%USERNAME%

Author

Commented:
I get this

C:\>subinacl /file D:\Cnn /setowner=LTH\admin
D:\Cnn - CreateFile Error : 2 The system cannot find the file specified.

Commented:
Is the path available?

does the command work with another path? I tested it using c:\temp without a issue

Commented:
Are you still having issues?

Author

Commented:
Yes path is available
it does nt work with other paths
Commented:
try it with \\.\D:\CNN