Solved

login scripts

Posted on 2011-09-20
8
329 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
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
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 
LVL 53

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Being a system administrator some time we require to do things remotely, one of them is installing software. Here I am going to tell you how to install software through wmic (Windows management instrument console). I am not at all saying that this i…
A quick step-by-step overview of installing and configuring Carbonite Server Backup.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

776 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