Solved

login scripts

Posted on 2011-09-20
8
328 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
 
LVL 52

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
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.

 
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

by Batuhan Cetin In this article I will be guiding through the process of removing a failed DC metadata from Active Directory (hereafter, AD) using the ntdsutil tool in a Windows Server 2003 environment. These steps are not necessary in a Win…
ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
A short film showing how OnPage and Connectwise integration works.

930 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

18 Experts available now in Live!

Get 1:1 Help Now