Best software for determining which computer a user is logged into?

Soldato
Joined
7 Mar 2005
Posts
19,586
Location
LU7
I work as the network manager in a small school in London. Occasionally we have students who are misbehaving whilst on a computer, accessing sites they shouldn't be or failing to follow instructions. I sometimes get asked to help the teacher log the student off. I would prefer to be able to do this remotely so that a student can't try to prevent themselves being logged off by blocking me from the keyboard/mouse.

I have a list of all the student usernames so what I would like is a program that I can use that will look for a student's username on all the active computers to tell me which computer they are logged onto. Then I can use the IP address of the machine to remote access it and log them off/reset their PC. :cool:

I did try Sysinternal's PsLoggedOn yesterday but that took too long. Any other ideas? Cheap/free programs are good! :p
 
during logon..

echo %computername% %date% %time% >x:\userlogs\%username%.txt

then you just open the user's text file to see which machine they are on.

if you put in >>x:\ (instead of one >) then it will keep adding to the file instead of replacing it.
 
Hi bledd. Doing that would mean editing our current logon scripts set up by our PC support company and they don't really let us do stuff like that. Is there no program that can scan all the active PCs on a network and return, for each computer, the IP address and the username of the current user?

If the above is the best solution I'll speak to our PC support company but they'll probably want to come up with their own version and I'd prefer to have a program that I can run without having to hassle them. They'd probably charge us for that kind of work anyway.
 
surely if the teacher is in a position to tell you the name of the student, they will also have the details of which computer they are on as well? :confused:

I would prefer to be able to do this remotely so that a student can't try to prevent themselves being logged off by blocking me from the keyboard/mouse.

i think this is quite sad. you're an adult getting physically blocked by a child and you want to get around it remotely? how about some discipline in the classroom instead? :(
 
Last edited:
surely if the teacher is in a position to tell you the name of the student, they will also have the details of which computer they are on as well? :confused:
Yes they can tell me which computer but I don't yet have a list of IP addresses matched to each PC.

i think this is quite sad. you're an adult getting physically blocked by a child and you want to get around it remotely? how about some discipline in the classroom instead? :(
Special needs school. :)
 
what kind of network are you running? if you're using static ip addresses you should have a inventory matching them all up. or if you're using DHCP, surely you can check under leases to see what IP is addressed to a computer name - which in turn should be in your inventory? so if the teacher reports pc2 in room7, it should be trivial to get the details you need.
 
Powershell can do it: http://stackoverflow.com/a/11190937/171703 .

With a bit of fiddling try this:

Code:
# Call script as .\getmachine.ps1 <user>
Param([String]$user)
 
# Get machine name user logged on to
Function GetUserComputer($machines, $user)
{
	# Loop over each machine
	foreach ($Machine in $MachineList)
	{
		# Get logged in user
		$loggedOnuser = @(Get-WmiObject -ComputerName $Machine -Namespace root\cimv2 -Class Win32_ComputerSystem)[0].UserName;
		
		# If logged in user is our user then return machine name
		if ($loggedOnuser -eq $user)
		{
			return $machine
		}
	}
	
	# User not logged on to any machine in machine list
	return "No matches."
}

# Read machines from file
$MachineList = Get-Content -Path "machines.txt"; # One system name per line

# Get computer user logged into
$computer = GetUserComputer $MachineList $user

# Attack!
Write-Host "Send drones to: $computer."

Save this to a file, getmachines.ps1.
Create a file in the same directory called machines.txt. In here put in all your computers (could probably scan it off the network, but for now do this), e.g.:
Code:
PC1
PC2
PC3

Open up Powershell (x86) (in your start menu) and run:
.\getmachines.ps1 DOMAIN\User

(you have to include the full domain part!)

It should say something like:
PS H:\Powershell> .\getmachines.ps1 XXXXXX-GROUP\yyyyyy
Send drones to: D001234.

Done!

You may have to enable scripts on powershell as a one off. Just run:
Code:
set-executionpolicy remotesigned
 
what kind of network are you running? if you're using static ip addresses you should have a inventory matching them all up. or if you're using DHCP, surely you can check under leases to see what IP is addressed to a computer name - which in turn should be in your inventory? so if the teacher reports pc2 in room7, it should be trivial to get the details you need.
DHCP. We don't have a list of which PC is which so even if a teacher tells me which PC, I don't have a way of working out which one it is. It's something I need to get done having just taken over.

PSLOGGEDON

http://technet.microsoft.com/en-gb/sysinternals/bb897545.aspx

Might do the trick......have to be admin over all pc's...
Tried that yesterday. Took too long and results weren't helpful in anyway.

Powershell can do it: http://stackoverflow.com/a/11190937/171703 .

With a bit of fiddling try this:

Code:
# Call script as .\getmachine.ps1 <user>
Param([String]$user)
 
# Get machine name user logged on to
Function GetUserComputer($machines, $user)
{
	# Loop over each machine
	foreach ($Machine in $MachineList)
	{
		# Get logged in user
		$loggedOnuser = @(Get-WmiObject -ComputerName $Machine -Namespace root\cimv2 -Class Win32_ComputerSystem)[0].UserName;
		
		# If logged in user is our user then return machine name
		if ($loggedOnuser -eq $user)
		{
			return $machine
		}
	}
	
	# User not logged on to any machine in machine list
	return "No matches."
}

# Read machines from file
$MachineList = Get-Content -Path "machines.txt"; # One system name per line

# Get computer user logged into
$computer = GetUserComputer $MachineList $user

# Attack!
Write-Host "Send drones to: $computer."

Save this to a file, getmachines.ps1.
Create a file in the same directory called machines.txt. In here put in all your computers (could probably scan it off the network, but for now do this), e.g.:
Code:
PC1
PC2
PC3

Open up Powershell (x86) (in your start menu) and run:
.\getmachines.ps1 DOMAIN\User

(you have to include the full domain part!)

It should say something like:


Done!

You may have to enable scripts on powershell as a one off. Just run:
Code:
set-executionpolicy remotesigned
Might look at that later. ;)

Our ICT people were in, I asked the guy this question and he showed me a way that'll work for us so I'll give that a go. It's Share and Storage management in Admin tools.
 
DHCP. We don't have a list of which PC is which so even if a teacher tells me which PC, I don't have a way of working out which one it is. It's something I need to get done having just taken over.

well stop slacking then. get on the case. :D

how any kind of organisation like a school doesn't have an inventory is quite shocking really. :p
 
We use some software called ABTutor that lets you see who's logged in, view or control their screens or send commands such as log off all remotely.

It's not free, but I'm sure there are other alternatives out there which are.
 
well stop slacking then. get on the case. :D

how any kind of organisation like a school doesn't have an inventory is quite shocking really. :p
Haha! Yessir. :D

We do have a list of what we own but we've not got anything that links IP addresses to machines so that I can translate what computer a student is at to an IP address for me to have some remote access fun. :p I'm not sure how often the IP addresses change so I was thinking of a list of computer names/IP addresses/MAC address so I have a comprehensive list.

We use some software called ABTutor that lets you see who's logged in, view or control their screens or send commands such as log off all remotely.

It's not free, but I'm sure there are other alternatives out there which are.
We have SmartSync but that's only on the teacher's PC in the IT room and it is mainly used to stop our students from just logging on and doing what they want. The teacher can lock the screens out so the students have nothing to look at apart from our teacher's PC.

The IT engineer we had out today recommended Netop. He says its cheaper and better. I would like to have something installed on my PC so I have options to log people off if needs be.
 
What sort of network manager are you? lol Surely you should have each PC Name matched with an IP and MAC address?
I've only just taken over as the network manager. My predecessor should have done this but he never did. I've got loads to do that should have been done and September is always a very busy month. My current to do list is longer than both my arms and one of my legs! ;)
 
What sort of network manager are you? lol Surely you should have each PC Name matched with an IP and MAC address?

I've never worked in an organisation that has that documented simply because it's easier to use DNS so once you have the computer name the IP address is a two second look up away or you just connect using the machine name.
 
As long as you have the name or IP, then you can get the other...

nslookup "IP"

or

ping "name"

then psloggedon on or use WMI commands to see who is logged on?

Simple WMI batch file:
setlocal
set /p Target=Please enter the Host or IP Address to Check who's Logged In:
wmic /node:%target% computersystem get username
endlocal
 
I've never worked in an organisation that has that documented simply because it's easier to use DNS so once you have the computer name the IP address is a two second look up away or you just connect using the machine name.

I thought that would be pretty standard practice in most IT places.

Where I work, we have it stored in Microsoft's SCCM system and also have a local spreadsheet of IP addresses and MAC addresses as we don't use DHCP.

We also make use of Spiceworks which keeps a full record of every PC on our network, and all information about the pc, such as IP, MAC, if its logged on or not, who's logged on. It does disk alerts and also keeps a record of any software which is installed or removed.
 
Hi MarcLister

It baffles me that you are the network manager and are not allowed to edit logon scripts?

Anyway back on topic. I use Spiceworks throughout my schools that I look after, I install it on the server and deploy the agent to all of the machines, it reports back with almost everything if set up right. You can also run reports on who last logged into a computer etc... It may be worth a look.

Regards
Kirbz

E: Just saw you have just taken over so you may get more control etc...
 
I've never worked in an organisation that has that documented simply because it's easier to use DNS so once you have the computer name the IP address is a two second look up away or you just connect using the machine name.
Sounds good. Once I make a map of all the classrooms and the names and positions of all the PCs in each classroom I can start to be a bit more effective if I need to be.

I thought that would be pretty standard practice in most IT places.

Where I work, we have it stored in Microsoft's SCCM system and also have a local spreadsheet of IP addresses and MAC addresses as we don't use DHCP.

We also make use of Spiceworks which keeps a full record of every PC on our network, and all information about the pc, such as IP, MAC, if its logged on or not, who's logged on. It does disk alerts and also keeps a record of any software which is installed or removed.
Well we are a small special needs school with a small ICT budget. We don't have SCCM or Spiceworks. How would we benefit from getting SCCM or Spiceworks?

Hi MarcLister

It baffles me that you are the network manager and are not allowed to edit logon scripts?
My boss was very insistent that we weren't allowed to do anything from our end. How true that was I don't know. It could have been that he didn't want me to get into that or perhaps he didn't know how to do stuff and didn't want me to show him up.

A
nyway back on topic. I use Spiceworks throughout my schools that I look after, I install it on the server and deploy the agent to all of the machines, it reports back with almost everything if set up right. You can also run reports on who last logged into a computer etc... It may be worth a look.

Regards
Kirbz
Cheers. I'm open to suggestions as I know I have a big opportunity to move things forward now. I wanted to change our website for ages but my boss wouldn't let me even though the website was horribly 1990s. I've redesigned it using Wordpress, a £35 theme and hosting for £8.50 a year. We were paying a company £250 ish each year! In a way there's so much I want/need/have to modernise that I can't do it all in one go. I want to be able to say to my successor (whenever that is) that here's a map of the network. It's up-to-date and accurate and will help you do your job rather than have to guess and hope. :)

E: Just saw you have just taken over so you may get more control etc...
Indeed. :) Incidentally I have a meeting with someone from the ICT company next week and I plan to use the meeting to clear up some things my boss told me; I'm not 100% sure if he told me the truth and I want to see what they say. I will ask what I can do without risking their wrath!
 
Back
Top Bottom