Link to home
Start Free TrialLog in
Avatar of OSXaddict
OSXaddictFlag for United States of America

asked on

VBscript to create folder named the same as the current user

Hello,

We are working on our logon script.  Every user in our organization has a "U:" drive. This is their personal storage place on the network.  We want to have our script check to see if there is a folder already there, and if there is, it should map it.  If there is not a folder there, it should create one named the same as the current user, and then map it.  All of our folders in this location are named the same as the username of the computer user.  Also, we would like to set the security on the folder so that only the current user, and our admin group on our domain can access it.. not sure if this is possible.. Very little VB experience unfortunately..

any help would be great
Avatar of David Lee
David Lee
Flag of United States of America image

Hi, OSXaddict.

I'm unclear on whether the the script is supposed to map the U: drive to the user's folder or it is supposed to check the U: drive to see if the folder exists there.  f the former, then where would the script check to see if the folder exists?  If the latter then what drive letter is the script supposed to map to the folder?
Avatar of OSXaddict

ASKER

Hello! The Script should check to see if there is a folder named the same as the current user sitting on one of our servers.  If the folder exists, then it should map the drive letter "U" to this folder.  

If the folder did not exist, (first time login) it should create a folder on this network server, and then name it the same as the current user.  Then it should map the folder to drive letter "U".

sorry to be unclear, thank you for the response!
ASKER CERTIFIED SOLUTION
Avatar of David Lee
David Lee
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Also, if you use the ADSystemInfo's UserName property (as in BDF's code) you're going to get the "Distinguished Name" for the user's folder which would look something like: "CN=John Doe,OU=Users,DC=fabrikam,DC=com".

The WScript.Network's UserName property would only be the user's Login Name, "JDoe"