Solved

i dont know computer name but how to find a computer name for that specific user

Posted on 2016-10-13
11
66 Views
Last Modified: 2016-10-14
i dont know computer name but how to find a computer name for that specific user
0
Comment
Question by:abcd ab01
  • 5
  • 3
  • 2
  • +1
11 Comments
 
LVL 94

Expert Comment

by:John Hurst
ID: 41842824
You should be able to find out from Active Directory on your computer.

Also, get Advanced IP Scanner (Famatech and free) to scan your network (assuming one subnet). That will give you computer names as well.
0
 

Author Comment

by:abcd ab01
ID: 41842828
and what about vice versa
if i dont know users name but have computer name
0
 

Author Comment

by:abcd ab01
ID: 41842831
how to find computer name ?
assoicated to that specific user?
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 94

Expert Comment

by:John Hurst
ID: 41842832
If you know the computer but do not have the information in Active Directory, then you need to access the computer itself.
0
 
LVL 24

Expert Comment

by:NVIT
ID: 41842835
0
 

Author Comment

by:abcd ab01
ID: 41842853
tried 1st link, it says rpc server is unavailable?
0
 
LVL 6

Accepted Solution

by:
Niten Kumar earned 500 total points
ID: 41842908
Try the powershell script below.



# Applies to: Computers
#
# Description: This script searches for a specific, logged on user on all or
# specific Computers by checking the process "explorer.exe" and its owner.
#
# ********************************************************************************

#Set variables
$progress = 0

#Get Admin Credentials
Function Get-Login {
Clear-Host
Write-Host "Please provide admin credentials (for example DOMAIN\admin.user and your password)"
$Global:Credential = Get-Credential
}
Get-Login

#Get Username to search for
Function Get-Username {
      Clear-Host
      $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-ADUser $Username
      if ($UserCheck -eq $null){
            Write-Host "Invalid username, please verify this is the logon id for the account!"
            Get-Username
      }
}
Get-Username

#Get Computername Prefix for large environments
Function Get-Prefix {
      Clear-Host
      $Global:Prefix = Read-Host "Enter a prefix of Computernames to search on (CXX*) use * as a wildcard or enter * to search on all computers"
      Clear-Host
}
Get-Prefix

#Start search
$computers = Get-ADComputer -Filter {Enabled -eq 'true' -and SamAccountName -like $Prefix}
$CompCount = $Computers.Count
Write-Host "Searching for $Username on $Prefix on $CompCount Computers`n"

#Start main foreach loop, search processes on all computers
foreach ($comp in $computers){
      $Computer = $comp.Name
      $Reply = $null
        $Reply = test-connection $Computer -count 1 -quiet
        if($Reply -eq 'True'){
            if($Computer -eq $env:COMPUTERNAME){
                  #Get explorer.exe processes without credentials parameter if the query is executed on the localhost
                  $proc = gwmi win32_process -ErrorAction SilentlyContinue -computer $Computer -Filter "Name = 'explorer.exe'"
            }
            else{
                  #Get explorer.exe processes with credentials for remote hosts
                  $proc = gwmi win32_process -ErrorAction SilentlyContinue -Credential $Credential -computer $Computer -Filter "Name = 'explorer.exe'"
            }                  
                  #If $proc is empty return msg else search collection of processes for username
            if([string]::IsNullOrEmpty($proc)){
                  write-host "Failed to check $Computer!"
            }
            else{      
                  $progress++                  
                  ForEach ($p in $proc) {                        
                        $temp = ($p.GetOwner()).User
                        Write-Progress -activity "Working..." -status "Status: $progress of $CompCount Computers checked" -PercentComplete (($progress/$Computers.Count)*100)
                        if ($temp -eq $Username){
                        write-host "$Username is logged on $Computer"
                        }
                  }
            }      
      }
}
write-host "Search done!"
1
 

Author Comment

by:abcd ab01
ID: 41842911
do I need to enter username or computername?
0
 
LVL 6

Expert Comment

by:Niten Kumar
ID: 41842959
Username
0
 
LVL 94

Expert Comment

by:John Hurst
ID: 41842961
if i don't know users name but have computer name  <-- So how is the user name entered if not known?
0
 

Author Closing Comment

by:abcd ab01
ID: 41844091
Thanks, great!
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Resolve DNS query failed errors for Exchange
When you try to share a printer , you may receive one of the following error messages. Error message when you use the Add Printer Wizard to share a printer: Windows could not share your printer. Operation could not be completed (Error 0x000006…
This tutorial will walk an individual through the process of installing the necessary services and then configuring a Windows Server 2012 system as an iSCSI target. To install the necessary roles, go to Server Manager, and select Add Roles and Featu…
The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.

830 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