Networking Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsSystem AdministrationNetworking Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 11th, 2004, 09:23 AM
dd/mm/yy dd/mm/yy is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 15 dd/mm/yy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 42 m 3 sec
Reputation Power: 0
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

Reply With Quote
  #2  
Old August 11th, 2004, 10:13 AM
edwinbrains's Avatar
edwinbrains edwinbrains is offline
Retired Moderator
Dev Shed God 4th Plane (6500 - 6999 posts)
 
Join Date: Jan 2004
Location: London, UK
Posts: 6,670 edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)  Folding Points: 85411 Folding Title: Advanced FolderFolding Points: 85411 Folding Title: Advanced FolderFolding Points: 85411 Folding Title: Advanced FolderFolding Points: 85411 Folding Title: Advanced FolderFolding Points: 85411 Folding Title: Advanced Folder
Time spent in forums: 1 Week 6 Days 23 h 39 m 19 sec
Reputation Power: 92
__________________
- Edwin -

The General Rules Thread | The General FAQ Thread

Reply With Quote
  #3  
Old August 11th, 2004, 11:02 AM
dd/mm/yy dd/mm/yy is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 15 dd/mm/yy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 42 m 3 sec
Reputation Power: 0
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

Reply With Quote
  #4  
Old August 12th, 2004, 01:30 AM
edwinbrains's Avatar
edwinbrains edwinbrains is offline
Retired Moderator
Dev Shed God 4th Plane (6500 - 6999 posts)
 
Join Date: Jan 2004
Location: London, UK
Posts: 6,670 edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)  Folding Points: 85411 Folding Title: Advanced FolderFolding Points: 85411 Folding Title: Advanced FolderFolding Points: 85411 Folding Title: Advanced FolderFolding Points: 85411 Folding Title: Advanced FolderFolding Points: 85411 Folding Title: Advanced Folder
Time spent in forums: 1 Week 6 Days 23 h 39 m 19 sec
Reputation Power: 92
Quote:
Originally Posted by dd/mm/yy
Any batch knowledge appreciated...


Sorry... my batch knowledge isn't really that good apart from the simple stuff. Maybe there's someone else here who can help

Reply With Quote
  #5  
Old August 12th, 2004, 06:49 AM
dd/mm/yy dd/mm/yy is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 15 dd/mm/yy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 42 m 3 sec
Reputation Power: 0
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!

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationNetworking Help > windows 98/XP login script troubles


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT