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!

Batch File Login Script Help - IF COMPUTERNAME

Status
Not open for further replies.

ToaDz

IS-IT--Management
Oct 19, 2003
26
AU
Hi Guys,

We have a Batch File login script, which maps users network drives as well as points to other VBS scripts, which execute other functions.

Each user logs in with their Windows username (Ie. Username1) and the Batch File automatically runs at login.

Here is a brief extract from our Batch File login script:

@ECHO OFF

NET TIME \\SERVER1 /SET /YES

NET USE G: \\SERVER1\Share1$
NET USE K: \\SERVER1\Share2$
NET USE S: \\SERVER2\Share3$
NET USE U: /home

REM Create a folder called "Admin" in Temp dir
CSCRIPT /T:20 \\SERVER1\NETLOGON\CreateAdminFolder.vbs

:END

Here is where I need help with...

We have several Terminal Services and Citrix Servers located in remote geographical locations. Users login to these servers to access applications using

their Windows username (Ie. Username1). These Terminal Services and Citrix Servers have server names of:

SV-SRV1
SV-SRV2
SV-SRV3
SV-SRV4
SV-SRV5

Each time a user logs in to one of these servers, the Batch File login script is run. The user does not need their drives mapped or any other functions to

be executed in order to access these applications. As you can imagine, each time a user logs in to one of these servers, its take quite a long time for them to login, as their drives are being mapped and so forth.

I understand that there is a batch file command called "IF %COMPUTERNAME%==".

Basically, I want the login script to be able to detect if a user is connecting to one of these Terminal Services and Citrix Servers, and if so, bypass the

drive mappings and other functions in the login script and go straight to ":END".

Would this work?

@ECHO OFF

IF %COMPUTERNAME%==SV-SRV1 GOTO END
IF %COMPUTERNAME%==SV-SRV2 GOTO END
IF %COMPUTERNAME%==SV-SRV3 GOTO END
IF %COMPUTERNAME%==SV-SRV4 GOTO END
IF %COMPUTERNAME%==SV-SRV5 GOTO END

NET TIME \\SERVER1 /SET /YES

NET USE G: \\SERVER1\Share1$
NET USE K: \\SERVER1\Share2$
NET USE S: \\SERVER2\Share3$
NET USE U: /home

REM Create a folder called "Admin" in Temp dir
CSCRIPT /T:20 \\SERVER1\NETLOGON\CreateAdminFolder.vbs

:END

What do you guys think? Have I got the right idea here and have I placed the "IF" statements in the correct area of the Batch File?

Your comments, suggestions and advise would be greatly appreciated.

Thanks to all! :)
 
Thanks again Poekies. I will give these a go and report back on the outcome.

Appreciate your input and assistance!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top