Solved

login scripts

Posted on 2011-09-20
8
330 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 54

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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Copy files from A to B (Only copy non existent or newer files) 7 298
network copying issue 4 72
2003 Server DNS/FS errors 6 74
ESXi VM of Server 2003 Saving Slow. 7 101
Scenerio: You have a server running Server 2003 and have applied a retail pack of Terminal Server Licenses.  You want to change servers or your server has crashed and you need to reapply the Terminal Server Licenses. When you enter the 16-digit lic…
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

730 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