?
Solved

Modify the VBScript to create folder and give rights to it

Posted on 2004-10-04
3
Medium Priority
?
539 Views
Last Modified: 2008-02-20
I have a simple vbscript that creates a folder called "home" locally on my PC. I want to modify the script so it can be used to create a home directory for ANY user on a file server, give the user(modify) rights to their home directory. This script will give the directory the users login name. I want the script to be able to run from any pc within my office, as long as the user running the script has the rights to do it.

I have a Windows 2003 AD domain, the PC's and Servers are all Win2kPro, WinXP, Win2k Server and Win2k3 servers...

ParentFolder = "C:\"
set objShell = CreateObject("Shell.Application")
set objFolder = objShell.NameSpace(ParentFolder)
objFolder.NewFolder "home"
0
Comment
Question by:bernardb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 3

Accepted Solution

by:
thunder_moose earned 2000 total points
ID: 12224921
Hey there,

To create a folder with the users username, use the following:

Set objNet = CreateObject("WScript.Network")
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CreateFolder("\\Yournetwork\Drive\" & objNet.UserName)
Set objFSO = Nothing
Set objNet = Nothing

To set the permissions of the folder, check this thread:
http://www.experts-exchange.com/Security/Win_Security/Q_21019361.html

Hope that helps,
TM
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
Six Sigma Control Plans
Introduction to Processes
Suggested Courses

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question