Link to home
Start Free TrialLog in
Avatar of WORKS2011
WORKS2011Flag for United States of America

asked on

Best way to know which computer a user is logged into, server 2003 (I know...I know...it's about to be replaced)

Have a user generating large amounts of spam would like to follow which computer(s) he's logging into.
ASKER CERTIFIED SOLUTION
Avatar of NVIT
NVIT
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Have a user generating large amounts of spam would like to follow which computer(s) he's logging into.

Normally this is a rouge SMTP engine on a particular system and would not follow the user unless you have roaming profiles.  Regardless you should be able to stop spam from leaving your network by stopping any outgoing traffic at the edge/router/firewall.  If you have a local email server limit the outgoing to the IP of the legit mail server.
As stated by Larry email can come from any machine. It is not based on where the user is logged into. However below is  a quest cmdlet that i found awhile back that allows you to find users that are logged into machines.

Add-PSSnapin Quest.ActiveRoles.ADManagement -ErrorAction SilentlyContinue
$ErrorActionPreference = "SilentlyContinue"

# Retrieve Username to search for, error checks to make sure the username
# is not blank and that it exists in Active Directory

Function Get-Username {
$Global:Username = Read-Host "Enter username you want to search for"
if ($Username -eq $null){
	Write-Host "Username cannot be blank, please re-enter username!!!!!"
	Get-Username}
$UserCheck = Get-QADUser -SamAccountName $Username
if ($UserCheck -eq $null){
	Write-Host "Invalid username, please verify this is the logon id for the account"
	Get-Username}
}

get-username
# Change this line of code for different search criteria's
$computers = Get-QADComputer -SearchRoot "ou=testou,dc=domain,dc=com" -OSName "*Windows*" -SizeLimit 0 | where {$_.accountisdisabled -eq $false}
foreach ($comp in $computers)
	{
	$Computer = $comp.Name
	$ping = new-object System.Net.NetworkInformation.Ping
  	$Reply = $null
  	$Reply = $ping.send($Computer)
  	if($Reply.status -like 'Success'){
		#Get explorer.exe processes
		$proc = gwmi win32_process -computer $Computer -Filter "Name = 'explorer.exe'"
		#Search collection of processes for username
		ForEach ($p in $proc) {
	    	$temp = ($p.GetOwner()).User
	  		if ($temp -eq $Username){
			write-host "$Username is logged on $Computer"
		}}}}

Open in new window


Will.
As Larry has suggested this is normally a spam bot transmitting hundreds of messages per minute.  You can use wireshark and place a hub/router behind your main firewall to capture smtp traffic and then identify which IP is going crazy.

I also use a small batch script at the domain level in the GPO to just log the username, IP, machine name, time and date when a user executes a login / loggoff located in a hidden share on one of my servers for my use only.
You can also turn off every machine and bring them up one at a time.  Unfortunately for any of these methods to work the spam bot has to be active and many of them send in bursts and are quiet much/most of the time.

Block port 25 outgoing at the firewall and scan each system wit the anti-malware app of your choice.  Malwarebytes or Super Anti Spyware are both good for this.
Are you using the native SMTP (IIS)? Well, if so, you can switch on the SMTP logging in IIS, leave it on for a couple of days and then import the resulting log file in Excel. Then, generate a Pivot Table counting by IP address, order it. That will give you the IP addresses in a Top Senders format. Match the offending source IP address with your DHCP database to find out the computer where the spam is coming from.

If you are not running the IIS SMTP, search your solution for a similar logging feature and then import the file in Excel.

Hope that it works for you.
Avatar of WORKS2011

ASKER

great thank you