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
Solved

Modify the VBScript to create folder and give rights to it

Posted on 2004-10-04
3
521 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
3 Comments
 
LVL 3

Accepted Solution

by:
thunder_moose earned 500 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
topping2 challenge 13 94
Java Loop 6 67
Meaning of "exceptions()" in "ist.exceptions( ist.exceptions() | ios_base:: badbit);" 3 79
What does != "" mean in programming 8 77
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

839 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