472,954 Members | 1,556 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,954 software developers and data experts.

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 2673
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
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
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
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
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
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
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
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
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
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
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
1
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.