Solved

login scripts

Posted on 2011-09-20
8
327 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
8 Comments
 
LVL 14

Expert Comment

by:Don Thomson
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 51

Accepted Solution

by:
Bill Prew earned 250 total points
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 7

Assisted Solution

by:redbmaster
redbmaster earned 250 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Hi all

Good help...all done now.

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

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Many of us need to configure DHCP server(s) in their environment. We can do that simply via DHCP console on server or using MMC snap-in on each computer with Administrative Tools installed in a network. But what if we have to configure many DHCP ser…
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…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

763 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now