Solved

How to use different logon scripts for the same users logging on to both workstations and citrix in the same domain

Posted on 2004-10-07
4
342 Views
Last Modified: 2010-04-12
Hi,

I have a citrix XP setup on w2k servers with a remote site connected to the citrix site via vpn. The computers on the remote site are members of the same domain as the citrix servers and the domain controller is placed in the citrix site. That means that the users when logging unto their computers are using the same usersname as when logging unto citrix and thus the same login script. My problem is that I do not want the same printers and network drives attached when they are logging into citrix as when logging into their computers. We are using a bat file and a vbs script for login. So here is my question: how can I make two seperate login scripts for the same username : one for citrix and one for the computer, or else how can I in the same login script seperate what lines should be executed depending on if the user is logging into citrix or the computer ?

Br Kasper
0
Comment
Question by:kasperprentow
4 Comments
 
LVL 10

Expert Comment

by:Longbow
ID: 12247232
When logged on on the Domain this registry key will change. The value is or the DomainName or the ComputerName.
Not sure if it is the case when the logon dialog box is opened (and the logon has not begin)

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultDomainName="DomainName"
0
 
LVL 83

Accepted Solution

by:
oBdA earned 500 total points
ID: 12247957
You can use the environment variable %COMPUTERNAME% to check on which machine your users are logging on. This will be set either to the workstation name or the Citrix server name.
If there's only one Citrix server, you can simply use

@echo off
if /i not "%ComputerName%"=="YourCitrixServer" goto CitrixEnd
:: *** This part is only executed when logging on to the Citrix machine:

:: *** Citrix part ends here.
:CitrixEnd

If you have several machine, you can use a list:

@echo off
set CitrixServer=Citrix01 Citrix02 Citrix03
set Citrix=FALSE
for %%a in (%CitrixServer%) do if /i "%ComputerName%"=="%%a" set Citrix=TRUE
if /i %Citrix%==FALSE goto CitrixEnd
:: *** This part is only executed when logging on to the Citrix machine:

:: *** Citrix part ends here.
:CitrixEnd
0
 
LVL 5

Expert Comment

by:talphius
ID: 12247991
What we do is add some logic to our one master login script that everyone uses.  There's a few ways to do this - 1)  You can do it on Operating System type (assuming you don't want the drives to map on regular servers either), or 2)  On Drive letter on the Citrix Server (All of ours are set to M:\ as the default drive, as to avoid drive letter conflicts when local client drives map on login)



****  Here's the revelant pieces - you will need to customize for Option 1: ****

'Connect to WMI on local machine to pull OS Type
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\.\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery ("Select * from Win32_OperatingSystem")
For Each objOperatingSystem in colOperatingSystems
      strOSCaption = objOperatingSystem.Caption
      strOSVer = objOperatingSystem.Version
      strSPMajor = objOperatingSystem.ServicePackMajorVersion
      strSPMinor = objOperatingSystem.ServicePackMinorVersion    
      windir = objOperatingSystem.WindowsDirectory
Next

Select Case strOSCaption
      Case "Microsoft Windows 2000 Professional"
            OSType = "Workstation"
      Case "Microsoft Windows XP Professional"
            OSType = "Workstation"
      Case "Microsoft Windows XP Tablet PC Edition"
            OSType = "Workstation"
      Case "Microsoft Windows XP Home"
            OSType = "Workstation"
      Case "Microsoft Windows 2000 Server"
            OSType = "Server"
      Case Else
            OSType = "Unknown"
End Select

If OSType = "Workstation" Then
<<Action Here>>

If OSType = "Server" Then
<<Action Here>>


**** For Option 2: ****

If Windir = "M:\WINNT" Then
      TSServer = True
End If


'Map Terminal Server drive mappings
If TSServer Then
<<Action Here>>


If Not TSServer  Then
<<Action Here>>
0
 

Expert Comment

by:anilskv
ID: 13312119
Another way would be to use the "%SESSIONNAME% environment variable. This variable is set to "Console" for local logons andset to "RDP-TCP#x" for logon using terminal services.

if %SESSIONNAME%==Console goto console

:TS
... terminal services related stuff goes here
...
goto end

:console
... local logon related stuff goes here
...
goto end

:end

Also, the environment variable "%CLIENT_NAME%" is set to the name of the machine from which the terminal services client is running. For a local logon, this envronment variable is not defined.

if defined %CLIENT_NAME% goto TS

:console
... local logon related stuff goes here
...
goto end

:TS
... terminal services related stuff goes here
...
goto end

:end
0

Featured Post

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

Join & Write a Comment

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
In this article, I will show you HOW TO: Suppress Configuration Issues and Warnings Alert displayed in Summary status for ESXi 6.5 after enabling SSH or ESXi Shell.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

757 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

21 Experts available now in Live!

Get 1:1 Help Now