Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

NT Logon Scripts

Status
Not open for further replies.

chesterbert

IS-IT--Management
Oct 31, 2001
6
GB
Can someone please help me with a mind blank. I need to add in my NT login script the facility to connect users drives automatically. EG

NET USE H: \\servername\THIS IS THE PART I CAN'T REMEBER

Can anyone help an aging, overworked IT person.

many thanks
 
You should put the share name after the servername. eg,
net use h: \\servername\sharename.

Hope this helps.
Chris
 
Thanks chris

I can connect if I know the username share. however I want to push this to all my users in one script.

is it not something like

net use h: \\servername\%username% ?
 
I don't know about %username% in a command prompt. In usermanager profiles for the usersm, the %username% works. In a login script, I'm thinking you would have to pass a variable that contains the username.
You might try searching microsoft site,
and search for mapping home directories in login scripts.

Chris.
 
to do this, in udm put home directory as \\servername\users\%username%

share out users folder to all. Then sub folders get created by NT with access only by that user. Then map

net use f: /home

They browse to f and see all users folders and can only get into their own.

sense2k - if profinst creates mail profiles based on who has logged on, I'd be grovellingly grateful for it as it is my main problem. zel@zelandakh.co.uk please... what does winset do?
 
Or...install Kixtart on your Domain controllers...this can be done without a reboot. With Kixtart, you can do this and many more cools, built-in, things. Like edit the registry of the machine logging in...or performing some action based on the client IP address.

Kixtart can be downloaded from It is free and widely used in the industry.

-hope this helps. Joseph L. Poandl
MCSE 2000

If your company is in need of experts to examine technical problems/solutions, please check out
 
In UMD, use \\sharename\username$
Create home directory (d:\homedirs\username)
Create correct NTFS permissions (user - change, system domain admin backup etc - full)
Share d:\homedirs\username as username$

On logon script (use a batch file .bat if using a 95 client!) use
net use z: /HOME
which will map the clients directory as specified in UMD

If using NT, clients dir should automatically map.

If you want to manage this via the logon script, use OS checking (check for OS variable - will only exist on NT) and goto commands to map the drives.

Good luck.

And dont forget you cannot deep map drives on NT!
eg, net use z: \\servername\directory\share WILL NOT WORK!
 
Simple stuff....

net use x: /delete /yes
net use x: \\servername\sharename /persistent:yes
net use u: /home

This will close and open all drive mappings whenever a user logs onto another w/s...

 
My 2 cents worth (and probably more than you want to know).

Syntax for NET USE is slightly different between Windows95/98/ME and WindowsNT/2000/XP.
Here is an example of where this comes in handy to meet the requirements of your question and others I've had for myself.

At the top of my Domain Logon Script, I test for 9x vs NT Class workstation and set various environment variables based on their "NET [USE | TIME | CONFIG]" requirements or availability for each of these types of stations (again, 9x vs NT)

Also, don't use Drive Z: for anything. Windows95/98/ME maps this drive letter in order to execute the Domain Logon Script.

*** START ***
Code:
@ECHO OFF
C:
REM Switching to the C: Drive executes faster on NT/2000/XP
REM A Windows95/98/ME station's current drive is initially  Drive "Z:".

IF     [%OS%] == [Windows_NT] GOTO WINNTENV
IF NOT [%OS%] == [Windows_NT] GOTO WIN9XENV

:WINNTENV
SET NETCONFIG=WORKSTATION
SET PERSISTENT=PERSISTENT:
IF EXIST \\%COMPUTERNAME%\ADMIN$\* SET NETTIME=/SET /YES
GOTO ACCESS

:WIN9XENV
SET OS=Windows_9x
SET NETCONFIG=/YES
SET NETTIME=/SET /YES
GOTO ACCESS

:ACCESS
SET DEPT=\\NTSERVER\Reserved
SET MANAGERS=\\NTSERVER\Reserved
SET EXECUTIVE=\\NTSERVER\Reserved

IF EXIST \\NTSERVER\Sales$\* SET DEPT=\\NTSERVER\Sales

IF EXIST \\NTSERVER\Acct$\* SET DEPT=\\NTSERVER\Acct

IF EXIST \\NTSERVER\Managers$\* SET MANAGERS=\\NTSERVER\Managers

NET USE M: /DELETE > NUL
NET USE M: %MANAGERS%$ /%PERSISTENT%YES > NUL
ECHO      M: %MANAGERS%

NET USE O: /DELETE > NUL
NET USE O: %DEPT%$ /%PERSISTENT%YES > NUL
ECHO      O: %DEPT%

REM In the commands below, NT/2000/XP automatically performs the mapping of Drive U: to the User, according to their <Profile> in &quot;User Manager for Domains&quot;.  The command &quot;NET USE U: /HOME /YES&quot; is only required for Windows9x Class stations. On WindowsNT/2000/XP, the U: Drive is ALREADY MAPPED and IN-USE and the CURRENT DRIVE\DIRECTORY (however, we did switched it to C: at the top of this Script).  So NT Class stations should not execute it, otherwise your Domain Logon Script will display an error.

IF [%OS%] == [Windows_9x] NET USE U: /HOME /YES > NUL
ECHO      U: \\NTSERVER\%USERNAME%
REM The ECHO command above will only display a complete directory on an NT Class station and simply &quot;U:\NTSERVER\&quot; on a 9x Class station.

:WELCOME
ECHO. Welcome...
NET TIME \\NTSERVER %NETTIME% | FIND /I &quot;Current Time&quot;

:LOG
NET TIME \\NTSERVER >> U:\NTLOGON.LOG
ECHO %OS% >> U:\NTLOGON.LOG
NET USE | FIND /I &quot;U:&quot; >> U:\NTLOGON.LOG
NET CONFIG %NETCONFIG% >> U:\NTLOGON.LOG
FOR %%Z IN (%PATH%) DO IF EXIST %%Z\IPCONFIG.EXE %%Z\IPCONFIG.EXE %IPCONFIG% >> U:\NTLOGON.LOG
ECHO.&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552;&#9552; >> U:\NTLOGON.LOG
*** END ***



Dudemaster
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top