l3wp Posted September 26, 2005 Posted September 26, 2005 A couple of nice goodies can be found in the environment variables on a Terminal Server. For instance: CLIENTNAME = *Name of the currently connected computer* HOMEPATH = *The current user's home directory* SystemRoot = *Obvious* TEMP = *The user's temp directory* USERNAME = *Obvious* SESSIONNAME = *The name of the current session ex. "RDP-Tcp#233"* You can get at them using System.Environment.ExpandEnvironmentVariable("%VarName%") where VarName = the variable you want Lew Parker EarthVectors Inc. Quote
Leaders dynamic_sysop Posted September 26, 2005 Leaders Posted September 26, 2005 you can use the IDictionaryEnumerator to itinerate through each entry, eg: [size=2][color=#0000ff]Dim[/color][/size][size=2] arrVariables [/size][size=2][color=#0000ff]As[/color][/size][size=2] IDictionary = Environment.GetEnvironmentVariables()[/size] [size=2] [/size][size=2][color=#0000ff]Dim[/color][/size][size=2] arrEnumerator [/size][size=2][color=#0000ff]As[/color][/size][size=2] IDictionaryEnumerator = arrVariables.GetEnumerator[/size] [size=2] [/size][size=2][color=#0000ff]While[/color][/size][size=2] arrEnumerator.MoveNext [/size] [size=2] [/size][size=2][color=#008000] '/// Key ( eg: LOGONSERVER ) , Value ( eg: \\DEN-HOME ) ...[/color][/size] [size=2][color=black][/color][/size] [size=2][color=black] Console.WriteLine(arrEnumerator.Entry.Key & " : " & arrEnumerator.Entry.Value)[/color] [/size][size=2][color=#0000ff]End [/color][/size][size=2][color=#0000ff]While[/color][/size] [size=2][color=#0000ff] [/color][/size] Quote
TheWizardofInt Posted February 28, 2006 Posted February 28, 2006 Is there a way to force the logged in user out or end its session? Quote Read the Fovean Chronicles Because you just can't spend your whole day programming!
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.