Page 1 of 1 1
Topic Options
#120941 - 2004-06-09 09:54 PM Make Directory (MD)
freakNik Offline
Fresh Scripter

Registered: 2004-04-15
Posts: 11
Hi Guys 'n' Gals,
I have created my user and have decided when they login in I will create their home directory. I have managed to do that, but I don't know how to use the @ERROR command. below is an example of what I'm trying to do.
;map home directory as first drive to the "Z" Drive
if Exist ("\\server\users$\@userid")
; ?"User path found"
USE Z: /DEL
USE Z: "\\server\users$\@userid" /PERSIST:NO
?UCASE("Home directory successfully mapped")
else
;Create the user's home directory if it does not exist
BEEP
?"Your home folder does not exist. "

??UCase("Please Wait ...")
??"The System is attempting to create your home folder"?

IF Exist ("\\server\USERS$\")
"Path to create home folder found" ;Ready to create Home Folder
MD "\\server\USERS$\@USERID" ;Here is where I'm trying to find out if an error occurred during creation.
else
"Path to create user's home folder not found" ;Time to Report Error
ENDIF
ENDIF

Is that OK or should I be using the @error macro. All suggestions welcome.


Top
#120942 - 2004-06-09 11:24 PM Re: Make Directory (MD)
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Well for Windows 9x you can't use the Z: drive as the Network redirector uses that during the logon process.

Have no idea why you would want to create the folder when the user logs on. That means that a user has TOO many rights at a parent folder level which means he/she can create any folder or remove any folder he/she wants at that level. Not a very secure practice.

Then how are you going to allow a normal user to share that folder? They won't have rights on the Server to share it.

Sorry guy, but I think this type of task should be handled by you or someone in your Helpdesk or IT Department.

Top
#120943 - 2004-06-10 01:41 PM Re: Make Directory (MD)
New Mexico Mark Offline
Hey THIS is FUN
****

Registered: 2002-01-03
Posts: 223
Loc: Columbia, SC
NTDoc raises some good points. However, if you are dead set on having this process driven by user logins (maybe you are trying to clear up unused accounts), you could simply have the script do the following: Users without home directories could write their user names to a centralized file with WriteProfile(), then periodically you (or another admin) could run an administrator script to create the folder(s), assign permissions, do the appropriate sharing, then clear the file for the next day.

What the hey... you could even have the admin script run hourly with task scheduler if you wanted. Or you could write a script that ran continuously, but paused a few minutes between each iteration. So many possibilities...

NMM

Top
#120944 - 2004-06-10 02:21 PM Re: Make Directory (MD)
freakNik Offline
Fresh Scripter

Registered: 2004-04-15
Posts: 11
Thanks guys
Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Henriques) and 2516 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.051 seconds in which 0.024 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org