Solved

Modify the VBScript to create folder and give rights to it

Posted on 2004-10-04
3
537 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 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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying 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

This article will show, step by step, how to integrate R code into a R Sweave document
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Progress

707 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