Solved

Detect Remotely if ANY User is Logged In

Posted on 2006-11-01
6
809 Views
Last Modified: 2010-05-18
This one can either be fun, or a pain in the neck.  It started out fun; now it's a pain in the neck so I'm gonna pass it on to you Experts.


I need a way to detect, remotely, whether a Windows XP computer is "in use" -- that is, whether somebody is presently logged-in.  The query that determines this might come from anywhere within the local network.

I do NOT necessarily need to know WHO is logged in.  That clearly raises some security and privacy concerns I'd best avoid.  I certainly won't consider it a deal-breaker to find a solution that happens to give me a username, but that's not really what I'm after.

I want to do this without exposing the system "in any way" -- that is, I don't want to have to poke new holes in existing security.  If it's necesasry to poke holes, I'd like to poke a really tiny one that allows only this information out.  I've found solutions, for example, that would allow remote querying of the entire registry; I don't consider that acceptable.


In case you'll find it inspirational, here's WHY I want to do this:

I have an application used in university computer labs that does things like take attendance, keep track of which students have questions, helps students find teaching assistants who are on-duty for their classes, et cetera.  This is a program students seeking help explicitly run from the desktop.  Obviously once it's running (and connected to a central server) I have all the information I need.

There are often students using computers who aren't in a class, though -- students who are just peacefully writing essays on, say, privacy rights.  I don't need (I don't WANT) detailed usage information from these people; they won't be running the application, so all is well.

The missing piece (what I'm asking you to find) is to tell me that somebody is logged-in to a computer who ISN'T running my application.  This allows me to answer questions like, "Are there enough free seats right now for a class of 30 people, or will we have to ask people to leave?"


Be aware that I've tried several potential solutions to this already without success, but will happily try several more if there's still hope of finding an answer.
0
Comment
Question by:VoteyDisciple
  • 3
  • 3
6 Comments
 
LVL 4

Accepted Solution

by:
KellyCraig earned 500 total points
ID: 17850587
run this in your script.

wmic.exe computersystem get UserName

if you want to output it to a file, just do one of these

wmic.exe computersystem get UserName > tothisfile
wmic.exe /append:pathtofile computersystem get UserName /format:xsl

If you need to knwo more, you can just run wmic.exe at the command prompt and type /?


PS: the command will return a value like this.

Username
KCDN-EVO\User

If no one is on, it will say

Username

XD
--Kelly
0
 
LVL 19

Author Comment

by:VoteyDisciple
ID: 17851196
That works correctly on my local machine, but on other machines (on which I do not have an account) I get an "Access is denied" response.  Of course, this is unsurprising.

What would I need to change on lab machines (which do not really have local users besides an administrative account) to allow this particular command to go through?
0
 
LVL 19

Author Comment

by:VoteyDisciple
ID: 17903673
Since I haven't heard anything here in a while I'm going to assume I've just phrased my question poorly and ask to have this one deleted unless anybody has any brilliant ideas forthcoming?
0
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 
LVL 4

Expert Comment

by:KellyCraig
ID: 17906676
Oh, yes, I am very sorry.
In order to poof the Access Denied error you would need to Right click the "My Computer" icons on each machine, select Manage and on the window that pops up there will be a navigation bar to the left.
Here you can either add \EVERYONE to the list of Administrative users, or you can click WMI Controls on the nav bar, and change the permissions manually on who can perform what Queries.
You can use that to assign permissions.

Ideally adding EVERYONE to the admin group or making an account on each of those machine with the same username/password as the machine you plan to run the scans from and adding that to the admin group.The command you'll want to run is something like this in batch file format.

--
for /F %%i in (\\computer\share\computers.txt) do (
      echo Processing %%i...
      wmic /Failfast:on /node:"%%i" /append:"\\computer\share\ouput.csv" computersystem Get UserName /format:csv
)
--

That would create a new line in the csv file for every machine in the computer.txt file.
Now, the fun thing is you can output it in any file in any format.
I chose csv as it is the easiest to play with if you are programming.
you can use /ouput:"file.something" however it will overwrite the file thus you would do a command liek this with output
--
wmic /Failfast:on /node:"%%i" /output:"\\computer\share\%%i_ouput.csv" computersystem Get UserName /format:csv
--
Then each computer would generate its own file.

Known /formats are as follows.
htable
xsl
xml
hform
text
csv
(google for others)

I hope I have answered your questions.

--Kelly
0
 
LVL 4

Expert Comment

by:KellyCraig
ID: 17906682
PS: to get around permissions you can make a batch file on each machine set to append a network shared file and have it scheduled through schedule and tasks in control panel on each machien with each respective admin accounts, then you dont have to touch permission.
0
 
LVL 19

Author Comment

by:VoteyDisciple
ID: 17975051
Sorry for the delay in returning to this; I've been waiting for a discussion with the Systems people, who've now rejected the idea of allowing this kind of access.  This is a pretty good solution to the question I asked, though, so I'll just close this now.  Finding a way to do this without changes in permissions remains the much more difficult problem.
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Xpmode vms all have same IP address. Not using Nat. 6 113
Hyper V vm 4 132
Clone HDD in RAID1 10 130
changing harddisk on computer in corporate 10 46
Ok I have been working on this for some time having learned and gained certification in XenDesktop 4 along came version 5 which was released last month. Since then I have been working to deploy XenDesktop 5 in a small environment with only 2 virt…
It is only natural that we all want our PCs to be in good working order, improved system performance, so that is exactly how programs are advertised to entice. They say things like:            •      PC crashes? Get registry cleaner to repair it!    …
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

809 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