|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
windows 98/XP login script troubles
Hey all
I'm creating a logon script for a small network of about 30 PCs, some Windows 98SE, some XP Pro. The login script currently synchronises the computers clock with the server, and maps some standard network drives. However, for certain usernames I want to map some extra drives. In the script I'm using the putinenv utility on the 98 machines to get the username (as it does not exist as an environment variable on 98) and then performing an if to check the username, like this: Code:
\\Server\netlogon\putinenv L /l ... if "%username%"=="testuser" goto mapIT This works fine on the 98 machines as the putinenv utility returns the username in lower case - so my test works fine. However on the XP machines, the username environment variable (which already exists on NT) is kept in the case that the user entered at the login screen, which could be TESTUSER, TestUser, TEstuSEr etc etc. This causes the if to fail, as it is not an exact match - is there any way to ignore case in the if, or to force the XP username environment variable into small case? Or any other ways around this? The full script is given below. Thanks in advance. Andy W dd/mm/yy Code:
REM echo off REM *** Display header, then synchronise time with SERVER echo Fleet Hire Logon Sequence echo. echo Synchronising server time... net time \\Server /set /yes echo. REM *** If NT (XP), go to clearNT REM *** If not, run putinenv to get username and go to mapmain if "%OS%"=="Windows_NT" goto clearNT \\Server\netlogon\putinenv L /l goto mapmain REM *** Clear any and all current drive mappings :clearNT echo Clearing drive mappings... net use F: /del net use G: /del net use H: /del net use O: /del net use P: /del net use T: /del net use U: /del echo. REM *** Map user and standard network drives :mapmain echo Re-mapping user/shared network drives... net use G: \\Server\F net use O: \\Server\OracleE net use U: \\Server\%username% echo. if "%username%"=="testuser" goto mapIT goto wait :mapIT echo Re-mapping IT network drives net use F: \\Server\D net use H: \\Server\H net use P: \\Server\OracleF net use T: \\Server\Barc goto wait :wait echo %username% pause :end |
|
#2
|
||||
|
||||
|
|
|
#3
|
|||
|
|||
|
Thanks for the quick reply edwin.
I've been playing with it for a while now, but cant seem to get it to work. The case changing batch file - uctolc.bat as I named it - returns the string in lowercase, however I don't know how to assign that string to a variable and then test it? I've tried using set but with no luck... this is what I have so far: Code:
set lowcase = call \\Server\netlogon\uctolc %username% if "%lowcase%"=="testuser" goto mapIT Doesn't seem to work though? Any batch knowledge appreciated... Andy W dd/mm/yy |
|
#4
|
||||
|
||||
|
Quote:
Sorry... my batch knowledge isn't really that good apart from the simple stuff. Maybe there's someone else here who can help ![]() |
|
#5
|
|||
|
|||
|
No worries, seeing as the problem was only with the XP machines, and seeing as XP can run VBScript login scripts, I created a VBScript file and called that from the batch file.
Then in VB i altered the case and mapped the appropriate drives. The 98 machines just run the batch all the way through as there wasn't a problem with case there. Nice workaround even if i say so myself! ![]() |
![]() |
| Viewing: Dev Shed Forums > System Administration > Networking Help > windows 98/XP login script troubles |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|