Solved

Modify the VBScript to create folder and give rights to it

Posted on 2004-10-04
3
495 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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
scoresClump  challenge 31 108
mapBully challenge 6 88
delphi parse string to params 3 81
groovy example issue 10 65
I know it’s not a new topic to discuss and it has lots of online contents already available over the net. But Then I thought it would be useful to this site’s visitors and can have online repository on vim most commonly used commands. This post h…
A short article about problems I had with the new location API and permissions in Marshmallow
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

744 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now