Sign in to follow this  
Followers 0
sedejong

Creating a new local group

4 posts in this topic

Good Afternoon All, I am very new to Autoit and so far love it! I am currently working on a project that creates a new folder in the root of C: and then needs to apply permissions to that folder.

I need to create a new group on the computer and then add domain accounts to that group, then add that group to the permissions on the new folder. Can someone point me in the right direction?

Example:

Computer Management | Local Users and Groups | Groups

Add New group called "LocalGroup1" and add the member "Domain\user"

Create a new folder called "Autoit" on the all users desktop.

Add "LocalGroup1" to the security of the new "Autoit" folder

Thanks a million everyone

Share this post


Link to post
Share on other sites



Assuming Windows XP, you could use the following DOS commands using RunWait(@ComSpec & ...

net localgroup

http://technet.microsoft.com/en-us/library/bb490706.aspx

This will create the local group and add members

cacls

http://technet.microsoft.com/en-us/library/bb490872.aspx

This will modify the folder permissions

To create the folder you could use the AutoIt function DirCreate()

Check the AutoIt help file for the correct syntax.

Share this post


Link to post
Share on other sites

I have something like this in a bat script formatting the L: drive. Raven1 is correct, if you want to add a group before hand run "net localgroup /add ...", assign that group permissions then assign permissions for the group. In this case the Users group I assign permissions to group is already created.

cd
diskpart /s InitSataDrive.inp
Format L: /FS:NTFS /V:DiskName /Q /X /Y
L:

mkdir FooData
cacls L:\FooData /E /G Users:C
mkdir L:\FooData\_systemdata
mkdir L:\FooData\Export

mkdir L:\FooDemoData
cacls L:\FooDemoData/E /G Users:C

Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

Share this post


Link to post
Share on other sites

Raven and bo8ster..... you guys are the BOMB!

after a little playing around with cacls and net localgroup. I have the program working like a champ!

Thanks a million

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