473,513 Members | 2,456 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Writing Session Specific Code For Windows 2003 Terminal Server Session

OHM
Hi peoples,

I dont know where to place this question, so as I know you guys are all
resourceful experts, I thought I would try here.

I am writing some code which will be run usingh remote desktop ( On windows
2003 Server ), I need to determine in the code the machine name and
username. If I use GetUsername and GetMachineName, it simply gives me the
name of the currently logged on user ( at the Server ) and the Servers
Machine Name.

Any Ideas ?

Regards - Terry
Nov 20 '05 #1
8 2716
Hi Terry,

I knew this was your name from the past however I was not sure.

Did you already try this for the user (I do not know if it works on a
terminal server however it seems so obvious for me), maybe you can get his
standard workstation as well for that however that I do not know direct.

Imports System.Security.Principal

AppDomain.CurrentDomain.SetPrincipalPolicy(Princip alPolicy.WindowsPrincipal)
Dim WinPrincipal As WindowsPrincipal = CType(Thread.CurrentPrincipal,
WindowsPrincipal)
Dim user As String = WinPrincipal.Identity.Name

Cor
Nov 20 '05 #2
OHM
Thanx Cor, I'll give it a go and see what happens, I also need to get the
calling machine name, do you have any ideas on this ?

OHM

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:%2******************@TK2MSFTNGP09.phx.gbl...
Hi Terry,

I knew this was your name from the past however I was not sure.

Did you already try this for the user (I do not know if it works on a
terminal server however it seems so obvious for me), maybe you can get his
standard workstation as well for that however that I do not know direct.

Imports System.Security.Principal

AppDomain.CurrentDomain.SetPrincipalPolicy(Princip alPolicy.WindowsPrincipal) Dim WinPrincipal As WindowsPrincipal = CType(Thread.CurrentPrincipal,
WindowsPrincipal)
Dim user As String = WinPrincipal.Identity.Name

Cor

Nov 20 '05 #3
Hi Terry,

I do not understand your meaning very well. When we terminal to a remote
terminal server, all the process run in the terminal session is just like
we do when we logon to the terminal server locally. So if we call the
Getusername and getmachinename we will get the same result just as we do
locally on the server.

So can you tell me what do you want to do? What is your expected behavior?

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 20 '05 #4
OHM
Hi Peter,

Basically we need to find the name of the User and the Netbios machine name
who has logged on to the terminal server. Ideally, the solution should be a
VB6 solution because thats what the code is written in, but if we can only
find a solution in .NET then we can user interop to get the info.

Cheers - OHM


""Peter Huang"" <v-******@online.microsoft.com> wrote in message
news:4T**************@cpmsftngxa10.phx.gbl...
Hi Terry,

I do not understand your meaning very well. When we terminal to a remote
terminal server, all the process run in the terminal session is just like
we do when we logon to the terminal server locally. So if we call the
Getusername and getmachinename we will get the same result just as we do
locally on the server.

So can you tell me what do you want to do? What is your expected behavior?

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 20 '05 #5
Hi OHM,

Can you give me a message when using that loggin information helps, I am
currious about that of course, theoratical it should work because it is the
principal who is using the application on terminal server.

However you never know.

Cor
Nov 20 '05 #6
OHM
Hi Cor,

Sorry I have not been able to try this out yet because I cant get to the
server, as soon as I have I will get back to you.

Regards - OHM
"Cor Ligthert" <no**********@planet.nl> wrote in message
news:Ow**************@TK2MSFTNGP09.phx.gbl...
Hi OHM,

Can you give me a message when using that loggin information helps, I am
currious about that of course, theoratical it should work because it is the principal who is using the application on terminal server.

However you never know.

Cor

Nov 20 '05 #7
OHM,
As Peter suggests, when you log into Terminal Server, the Terminal Server IS
the netbois machine name the user is logged into!

Do you mean the client PC where the Terminal Server client is running?

I have not tried it, but the WTSQuerySessionInformation API looks promising.
To get information from Terminal Server I understand you need to use
Terminal Services, which can be found at "Windows Development - Windows Base
Services - Terminal Services" it part of the Win32 API set. I really don't
know if the above is already exposed in the Framework or not.

Hope this helps
Jay
"OHM" <Me@NoWhere.Com> wrote in message
news:uz**************@tk2msftngp13.phx.gbl...
Hi Peter,

Basically we need to find the name of the User and the Netbios machine name who has logged on to the terminal server. Ideally, the solution should be a VB6 solution because thats what the code is written in, but if we can only
find a solution in .NET then we can user interop to get the info.

Cheers - OHM


""Peter Huang"" <v-******@online.microsoft.com> wrote in message
news:4T**************@cpmsftngxa10.phx.gbl...
Hi Terry,

I do not understand your meaning very well. When we terminal to a remote
terminal server, all the process run in the terminal session is just like we do when we logon to the terminal server locally. So if we call the
Getusername and getmachinename we will get the same result just as we do
locally on the server.

So can you tell me what do you want to do? What is your expected behavior?
Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no

rights.


Nov 20 '05 #8
OHM
Thats exactly what I was looking for.

Many Thanks Jay

OHM
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:ui**************@TK2MSFTNGP10.phx.gbl...
OHM,
As Peter suggests, when you log into Terminal Server, the Terminal Server IS the netbois machine name the user is logged into!

Do you mean the client PC where the Terminal Server client is running?

I have not tried it, but the WTSQuerySessionInformation API looks promising. To get information from Terminal Server I understand you need to use
Terminal Services, which can be found at "Windows Development - Windows Base Services - Terminal Services" it part of the Win32 API set. I really don't
know if the above is already exposed in the Framework or not.

Hope this helps
Jay
"OHM" <Me@NoWhere.Com> wrote in message
news:uz**************@tk2msftngp13.phx.gbl...
Hi Peter,

Basically we need to find the name of the User and the Netbios machine name
who has logged on to the terminal server. Ideally, the solution should be a
VB6 solution because thats what the code is written in, but if we can only find a solution in .NET then we can user interop to get the info.

Cheers - OHM


""Peter Huang"" <v-******@online.microsoft.com> wrote in message
news:4T**************@cpmsftngxa10.phx.gbl...
Hi Terry,

I do not understand your meaning very well. When we terminal to a remote terminal server, all the process run in the terminal session is just

like we do when we logon to the terminal server locally. So if we call the
Getusername and getmachinename we will get the same result just as we do locally on the server.

So can you tell me what do you want to do? What is your expected behavior?
Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no

rights.



Nov 20 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2904
by: Geoff Winsor | last post by:
Hi, I am experiencing a problem with recalling a session variable which stores whether a person is logged in to a "members only" section of a website. This area of the site has been working...
1
2035
by: Gary K | last post by:
I am trying to setup remote debugging on my first client-server setup, so hopefully this problem is just stupidity on my part. The client machine is running Windows XP Pro/SP2 with Visual Studio...
2
2467
by: Hans | last post by:
I am using Process.GetProcessesByName("SomeName") in my app and it workes on most windows platforms. On most - it does not work in a terminal server session on a Windows 2003 server. Although the...
1
1586
by: mwolf | last post by:
I have an application written in c$ that needs to be run in 3 different terminal server sessions on a windows 2003 server. Everything will work fine for about an hour, after this point the...
9
2438
by: William LaMartin | last post by:
I have a problem, mentioned here before, of Session and Application variables disappearing at one site but not at others or on my development computer. The problem is illustrated by an example...
3
3452
by: Gary K | last post by:
After a bit a trouble getting VS to create a project on a different web server (I forgot to apply the 'fix'), I get the following error when trying to debug my web application. Error while...
5
5258
by: fbwhite | last post by:
I know this issue has been brought up many times, but I have tried many of the solutions to no avail. I wanted to give my specific case to see if someone could be of any help. We are using the...
9
2534
by: Adrian Parker | last post by:
We have a website that works everywhere but on a few PCs on this one site.. Asp.Net 1.1 Server = Windows 2003 Client = XP In the web.config we use - cookieless="false" in the browser settings...
6
2506
by: rekaeps | last post by:
We are developing an ASP.NET 2.0 (C#) application, and I'm having troubles sending e-mail from the server when accessing the web site from a separate client computer. Also, in the same scenario,...
0
7260
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7160
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7384
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7537
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7099
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7525
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5685
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3233
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1594
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.