Sign in to follow this  
Followers 0
kmps

how to set the NTFS rights using AUTOIT

7 posts in this topic

Hello,

I am now trying to write a script to set NTFS rights automatically,any good man can tell me how I can

deal with it without using GUI?

thanks a lot!

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hello,

I am now trying to write a script to set NTFS rights automatically,any good man can tell me how I can

deal with it without using GUI?

thanks a lot!

Maybe not a good man, how about a semi-well behaved penguin?

Google up more information on the command line utility XACLS.EXE or you'll have to find the appropriate COM objects for filesystem management.

Hope that helps. :D

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

cacls filename

It may not give you all the little nooks and crannies about NTFS permissions, but should work for basic rights (read/write/change/full).


Writing AutoIt scripts since
_DateAdd("d", -2, _NowCalcDate())

Share this post


Link to post
Share on other sites

Hi.

Was seaching for the same question, to be natively solved with autoit. Doesn't look like it's integrated with autoit, so I think I will go ahead using setacl.exe or setacl.ocx of Helge Klein.

Just to mention it, ven though it's a very old thread :)

Regards, Rudi.


Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Share this post


Link to post
Share on other sites

Hi rudi,

if you're running Win2008 / Vista and up, you can use icacls.exe which is very powerful. I implemented a few scripts on that basis.


Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

This is something I threw together for our helpdesk to run from their XP boxes. Might give you a starting point.

$var = InputBox("Grant Access", "Enter the user ID")
$dir = InputBox("Directory", "UNC path to parent directory")
$perm = InputBox("Level of Access", "Enter the level of Access: C(hange), F(ull control), R(ead only), W(rite)")

While 1

  $var2 = FileSelectFolder("Choose a folder.", $dir, 1)
        RunWait( 'CACLS "' & $var2 & '" /E /G ' & $var & ':' & $perm, "", @SW_HIDE )
        $var3 = MsgBox(4, "Complete", "Would you like to specify another directory?")
  If $var3 = 7 Then ExitLoop

WEnd

MsgBox(0, "Access Granted", "Access has been granted to the specified directories.")
Edited by JLogan3o13

When you're dead, you don't know you're dead - it's only difficult for those that know you. It's the same way when you're stupid...

My Scripts: SCCM UDFInclude Source with Compiled Script, Windows Firewall UDF

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0