473,857 Members | 1,986 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Webpage to see if someone is logged into PC's via RDP

I am trying to put together a web page to show remote users which PC's are
available for RDP so they can use. The page work's fine except for when the
goes to the pc to pull the info on if anybody is logged in or not it seems
to have trouble. here is the blurb from the temp file that gets created on
the webserver.
"Error opening Terminal server Computer-01 Error [5]:Access is denied."
The webserver Anon account is using a Domain account that has full rights on
those boxes. Below is my webpage.

<HTML>
<HEAD>
<TITLE>Blade Availability.&n bsp; Please be Patient!</TITLE>
<SCRIPT LANGUAGE="VBScr ipt" runat="server">
Response.Buffer =True
Response.Expire s=-1
Server.ScriptTi meout= 600
On Error Resume Next

' This script will pull computers from a text file and give you feedback if
someone is logged in via local or RDP.

Dim fso, f, inputFile, strCompName, strUserName

'Text file has a list of PC's I want this script to run against
inputFile = "\\Servername\t ext\computers.t xt"

set fso = CreateObject("S cripting.FileSy stemObject")
set f = fso.OpenTextFil e(inputFile)

Do While f.AtEndOfLine <> True
strCompName = Trim(f.ReadLine )
If strCompName <> "" Then

strCompName = UCase(strCompNa me)
strUserName = GetUser(strComp Name)

If IsEmpty(strUser Name) Then
Response.Write strCompName & " ; Could not connect to computer " &
"<br>"
Response.Flush( )
ElseIf strUserName = "" Then
Response.Write strCompName & " ; No user is logged on " & "<a
href=""rdp.asp? hostname="&wks( r) &""">CLICK here to connect</a><br>"
Response.Flush( )
Else
Response.Write strCompName & " ; Logged on user name: " &
strUserName & "<a href=""rdp.asp? hostname="&wks( r) &""">CLICK here to
connect</a><br>"
Response.Flush( )
End If
End If
Loop

f.close

wscript.echo "end of file"
Function GetUser(sHost)
' Function will return logged in user name from QWINSTA.EXE
' regardless of it is a console or RDP user
' Windows XP only
'
' Return values:
' If input to function (host name) is empty, returns Empty
' If QWINSTA.EXE cannot connect to host, returns Empty
' If no user is listed by QWINSTA.EXE, returns ""
' If user is listed, returns user name

If sHost = "" Then
Exit Function '-----> return Empty
End if

Set oShell = CreateObject("W script.Shell")
Set oFS = CreateObject("S cripting.FileSy stemObject")

sTmpFile = oFS.GetSpecialF older(2).ShortP ath & "\" & oFS.GetTempName

response.write( sTmpFile)

'Run command and redirect stdout and stderr into temp file
oShell.Run "%ComSpec% /c %SystemRoot%\Sy stem32\QWINSTA. EXE /SERVER:" _
& sHost & " >" & sTmpFile & " 2>&1", 0, True

On Error Resume Next
'Open the temp file
Set oTF = oFS.OpenTextFil e(sTmpFile)

'Parse the file

' Read first line
sLine = oTF.ReadLine
If Err.Number <> 0 Then
' Something is wrong.
Exit Function '-----> return Empty
End If
On Error Goto 0

If Left(Trim(sLine ), 26) <> "SESSIONNAM E USERNAME" Then
' Something is wrong. Most likely is the content of the first line
' this: "Error opening Terminal server <host name>"
Exit Function '-----> return Empty
End If

' Read second line
sLine = oTF.ReadLine
'Close file
oTF.Close
'Delete it
oFS.DeleteFile sTmpFile

sChoppedLine = Mid(sLine, 20)
If Left(sChoppedLi ne, 1) = " " Then
' no user found
GetUser = ""
Else
' get the user name
GetUser = Split(sChoppedL ine)(0)
End If

End Function
</SCRIPT>
</BODY>
<body bgcolor="#EBF2F C">

<p>&nbsp;</p>
<p>&nbsp;</p>
<p align="center"> <font size="5">Remote Desktop Connections</font></p>
</HTML>


</SCRIPT>
</BODY>
</HTML>
Jul 22 '05 #1
0 4296

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

Similar topics

2
2116
by: Maarten Koster | last post by:
Hi, I want to copy a page from the internet with fopen and fread. Now the problem is that you have to be logged in with a sessin to get to that page. Now I tried a couple of things. I tried to simulate the output of the login form in a link and open it with fopen and fread, to make the website see php as a logged in user, and then let the same script php copy the page I want. This did not work. Than I tried to open the page with...
5
1993
by: clivegisworkuk | last post by:
Hi I have copied an ASP tutorial running on pocket IE. 1) The ASP does not run on Pocket IE, comes-up with error: No application associated with .. 2) The script also appears in the webpage. Any ideas why????
1
1597
by: John Puopolo | last post by:
All: I am writing a "net send" like application. The application runs on each person's PC, waiting for messages. Let's suppose "Joe" is logged in to 2 PCs, A and B. I would like to enter acommand (from my PC) like: sendto joe hello I would then like a window to pop up on PC A and PC B with "hello." In order to do this, I need a way to determine all of the computers where Joe
3
5833
by: Ole Hanson | last post by:
Hi I am trying to pass a credentials object to a webpage programmatically. I have a winApp (C#) that I want to be able to open a webpage (by starting IE), but the credentials required by IIS serving this webpage should be sent along automatically. This to prevent the user from being forced to login to the site. It should be something like LOGONUSER from the User32.dll native API, but just to a webpage...
2
1482
by: Stefan Reinmers | last post by:
hi there, i include in a webpage (with the object tag) a dll to show in the webpage a windowsform (windowscontrollib.dll) when i test all on the development pc (winxp ,framework 1.1) it works fine. attention the dll needs some more dlls which are in the folder where the main dll lies. when i test it now from another computer the webform will not show. (same settings) it seems that the dll don't load the other needed dlls what can i do...
3
5769
by: Dave Smithz | last post by:
Hi there, I have a website where users can log into. This users sessions as I believe most people use when implementing a login section of a website (each php page first checks a valid parameter has been set to authorise that the user has logged in and if it is not found it redirects the user to the login page). I have my code and it works fine, however on the live server, after a period of inactivity the user will be logged out...
3
15921
by: Lattis | last post by:
I have the following problem: User A is logged in to a windows 2000 terminal. He runs an application which runs under the credentials of a different user. If I try to see the current user throught the application I can only see the user that started the thread. How can I see the user that is logged in?? I tried the following code: Private Function GetUser() As String
3
5668
by: fomalhaut | last post by:
Hi All, I am building a tool for one of our company's service desks, and one of the functions I'm hoping to add is the ability to enter a username and find what PC that user is currently logged into. As AD doesn't store this kind of information, is there any source I can get this information from? Thanks,
1
1322
by: Claudia Fong | last post by:
HI I got this error after creating a virtual directory in my pc and tried to open the webpage... Server Error in '/webpda' Application. ------------------------------------------------------------------------ -------- Access denied to 'C:\WebApp\'. Failed to start monitoring file changes. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information
0
9923
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9767
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11081
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10709
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10394
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9544
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5773
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4592
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 we have to send another system
3
3214
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.