Solved

login scripts

Posted on 2011-09-20
8
331 Views
Last Modified: 2012-05-12
Hello Experts

We have just implemented a terminal server and I am playing around with the login scripts.

Now we have a few restrictions which I am putting in place through command line.

So I want to add these commands in the login script for the users, however it needs to run ONLY if the user is logging into the TS and no otherwise.

I do remember seeing something like...

IF COMPUTERNAME == TS GO TO...

And using label to run a bunch of commands for TS.

However, I don't remember it anymore and can't work it out after playing with commands for one hour or so.

So can someone help me here please?

Its rather urgent as the danm thing goes live tomorrow....
0
Comment
Question by:alex110109
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 14

Expert Comment

by:Don Thomson
ID: 36568303
your example above IF COMPUTERNAME == TS GO TO...

doesn't make any sense

When you use TS - The computer you are lgiing into is the COMPUTERNAME - There is no way of really passing local info from the remote PC to the TS.

Everyone logging in has to be a member of the Remote Desktop Groupl so most of what you need to do could be done in the GPO

If a User needs access via TS - Give them a second Username - different from their local username - and only those usernames go in the Remote Desktop group


0
 

Author Comment

by:alex110109
ID: 36568365
Hi DHT

You didn't understand the issue properly.

This is what I need.

Currently, the login script has say 3 commands in it that run everytime a user logins to any computer.

(We have a AD Domain environment, which I failed to mention above, apology for that).

What I want is that when the user logs on to the TS, I want 2 more commands to run, but ONLY when the user logs on to the TS and not any other computer.

That's why the "IF COMPUTERNAME == TS" command so that the script can check if the user is logging on to the TS or any other computer.


0
 
LVL 3

Expert Comment

by:pnorms
ID: 36568422
Create a new OU place the TS in it and create a GP with a new startup script doing whatever you want.
That is the right way to do it.

Other wise you could do something like this:
if "%computername%"=="MIS-PNORMAN-7" goto runit
:notit
echo Not The PC
:runit
echo Run IT

Open in new window

0
Comparison of Amazon Drive, Google Drive, OneDrive

What is Best for Backup: Amazon Drive, Google Drive or MS OneDrive? In this free whitepaper we look at their performance, pricing, and platform availability to help you decide which cloud drive is right for your situation. Download and read the results of our testing for free!

 
LVL 55

Accepted Solution

by:
Bill Prew earned 250 total points
ID: 36568468
Sounds like you want to do all the normal login logic PLUS a couple more things.  If that's the case then you could do:

@echo off
REM normal logic here...
REM normal logic here...
REM normal logic here...
IF "%COMPUTERNAME%" == "TERMINALSERVERNAME" (
  REM additional TS logic here...
  REM additional TS logic here...
)

Open in new window

~bp
0
 
LVL 7

Assisted Solution

by:redbmaster
redbmaster earned 250 total points
ID: 36568481
This would only really work with RDS or Citrix published desktop.

It my environment has a Citrix farm and this is kind of how our batch file runs.

Say our farm contains the following servers:
Corp-Citrix1
Corp-Citrix2
Corp-Citrix12
Corp-Citrix432

We have one login script that looks like:

Run these commands for all users (like mapping drives).

if %COMPUTERNAME:~0,11% == CORP-CITRIX goto Citrix

:Computer
      Run these commands for PC users
   goto End

:Citrix
      Run these commands for Citrix users
   goto End

:End

Open in new window

0
 

Author Comment

by:alex110109
ID: 36568517
excellent guys, thanks for this.

i will test all the suggestions and will let you know which one i find the simplest to use
0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 36569702
A further way in a domain environment is put the terminal server in it's OU.  Then on that OU apply any scripts,or other settings that you want users to have.  Then you have to set that policy to use "loopback".  This means the user policy on the computer's container is run aswell or instead of the ones on the users' containers.

Depends how complicated your environment and GPO's are but if it is simple then go with the logon script change.

Steve
0
 

Author Closing Comment

by:alex110109
ID: 36580839
Hi all

Good help...all done now.

I sort of combined the script commands given above and hence the split :)
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Setting up a Microsoft WSUS update system is free relatively speaking if you have hard disk space and processor capacity.   However, WSUS can be a blessing and a curse. For example, there is nothing worse than approving updates and they just have…
YESTERDAY YESTERDAY.BAT is inspired by a previous article I wrote entitled: TOMORROW.BAT (http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/MS_DOS/A_4196-Advanced-Batch-File-Programming-TOMORROW-BAT.html). The crux of this batch f…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question