Koozali.org: home of the SME Server

XP and netlogon.bat

Derek

XP and netlogon.bat
« on: February 14, 2002, 11:18:26 PM »
The default netlogon.bat causes problems when an XP Pro client (or any NT flavour actually) joins the domain. (This file works perfectly for Win9x clients)

This line:

net time \ckuamain /set /yes

produces this error:

Sytem Error 1314 required priveledge not held by client.

This line:

net use h: /home

produces this error:

System Error 85 local device name is already in use

Drive h: does actually get mapped to /home, but for some reason a drive z: also gets mapped to /home. Does anyone know the correct netlogon.bat syntax to deal with both WinXP and Win9x clients? (Or is there a setting somewhere within XP that needs to be changed)

Server is SME 5.1

Des Dougan

Re: XP and netlogon.bat
« Reply #1 on: February 15, 2002, 06:15:49 AM »
Both those commands work fine on Windows 2000, and I have seen nothing to indicate that they wouldn't work on XP Pro. XP Home doesn't support domain logons - is that the version you have?


Des Dougan

Craig Foster

Re: XP and netlogon.bat
« Reply #2 on: February 15, 2002, 11:06:39 AM »
Regarding the H: assignment, you may find that Z: and or H: have already been assigned by the server. If you've got persistant connections, the H: will be used for profiles, therefore stopping you from trying to change or renew the mapping.

As for the NET TIME \SERVER /SET /YES, it does work on 2000Pro and XPpro, provided that you have turned off secure logins (end of the XP & SMB 2.2.2 FAQ)

It fails when I'm not a domain member, or I'm logged into a different domain though


Regards,

Craig Foster

Tyrone C. Miles

Re: XP and netlogon.bat
« Reply #3 on: February 15, 2002, 06:25:56 PM »
I know in a real windows NT domain you only use the NET USE H: /HOME statement for non NT computers. Because NT pulls that info from the domain database. In an NT domain you instead of putting NET USE H: /HOME in your script for NT machines you add in in user manager in the user account under profile. It gives you a choice under the option Home Directory ether Local Path or Connect "Drive letter" to \server\homedir$ NT, 2000 and XP pro machines know to pull from that. 95, 98, ME machines don't and need the NET USE H: /HOME statement to tell them to get the info from domain user database.

What I wound up doing is making a custom template for my logon script then using  %U.bat as my script (which allows you to make a different logon script for each user using their logon name as the script name in caps.)
Then you can just map h: to the users home dir.

I just wrote a new script today but have not tried it yet. I will share it here then try it when I get to my house tonight and tell you on here how it went!

TMILES.bat :

if "%OS%" == "windows_NT" goto NT_OS

net use h : /home
net use s: \server\dir

goto time

:NT_OS
net use h: \server\tmiles /persistent:no
net use s : \server\dir /persistent:no

:time
net time \server /set /yes

:end
pause


The time command works for me with my XP pro machine no problem, and I know the if "%OS% == statement works fine in an NT domain using NT, 2000 and XP pro machines so it should work with samba but I have not tried it yet. The persistent statement causes NT machines to drop the drives that they have mapped after each reboot. If you don't use it everytime you run the script you will get an error saying the resource is all ready in use.

Anyway I hope this helps.

Derek

Re: XP and netlogon.bat
« Reply #4 on: February 15, 2002, 08:02:45 PM »
That helped - thanks Tyrone.

There is one syntax error in the script:

if "%OS%" == "windows_NT" goto NT_OS has to be:
if "%OS%" == "Windows_NT" goto NT_OS

It is case sensitive and doesn't goto the NT_OS section without the capital W.

I am still getting 2 home mappings, both h: and z: even thought the script no longer maps one. (The local device name is already in use error is now gone.) So I just used a silly workaround - I added this line to the end of the script:

net use z: /delete

If anyone knows where that z: mapping is coming from please enlighten me.

Thanks,

Derek

Tyrone C. Miles

Re: XP and netlogon.bat
« Reply #5 on: February 15, 2002, 08:10:39 PM »
Thanks a lot, I have not seen the Z mapping yet in my use of scripts :( I will see what happens when I try my new script at home. :)

Craig Foster

Re: XP and netlogon.bat
« Reply #6 on: February 18, 2002, 03:51:39 AM »
AFAIK:-

Z: is automatically mapped when Windows 2000 or XP connect to a home directory on a server that contains profiles - whether you use them or not...

I usually add the "NET USE Z: /DELETE" to remove the dirve mapping, but sometimes if your client machines are recalcitrant, there will still be files open on Z:, denying you the /DELETE.

For more fun with netlogon script for those that have Win9x machines, I also use svar-dos.exe - is a LanMgr ResKit download that has since disappeared from TechNet that gives Win9x clients env variables like %USERNAME%
You can download a copy from http://www.wwtlg.com.au/resources/svar-dos.zip
Instructions for use are available at http://support.microsoft.com/default.aspx?scid=kb;en-us;Q67868 otherwise known as MSKB Q67868.

Regards,

Craig Foster