I suggest… Modules
Sep 21

At my previous workplace we used to create PST-s for Outlook and roaming profiles on separate network drives. The process was 1. setup the user in Active Directory, 2. create the folders, 3. setup permissions on folder. Now I thought why not merge the last two steps. I used VBS to create the folder and later I used cacls to set the permissions.

How to do that? You need to call up the command line from the VBS file:

1
2
Dim intRunError, objShell, strFolder
intRunError = objShell.Run("%COMSPEC% /c Echo Y| cacls " & strFolder & " /t /c /g DomainUsername ", 2, True)

By adding the Y| you always give the yes answer to any of the questions which might come up while processing the cacls.

The basic syntax for cacls is as follows:

cacls FileName [/t] [/e] [/c] [/g User:permission]/t : Changes DACLs of specified files in the current directory and all subdirectories.

/e : Edits a DACL instead of replacing it.

/c : Continues to change DACLs, ignoring errors.

/g User:permission : Grants access rights to the specified user. The following table lists valid values for permission. (n: none, r: read, w: write, c: change, f: full)

Leave a Reply

Powered by WP Hashcash