Advertisement

02.14.2008 at 07:13AM PST, ID: 23163110
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

How to tell which users in a group log on which computers?
Tags: Microsoft, Windows, 2000, Active Directory LDAP Query
I have a bunch of users in a given group. I need to know which users use what computers. I would prefer to use a LDAP query on a Windows 2000 Server PDC.
Start your free trial to view this solution
Question Stats
Zone: Database
Question Asked By: Saraha777
Solution Provided By: maxis2cute
Participating Experts: 2
Solution Grade: A
Views: 0
Translate:
Loading Advertisement...
02.14.2008 at 07:23AM PST, ID: 20894002

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.14.2008 at 07:30AM PST, ID: 20894075

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.14.2008 at 09:11AM PST, ID: 20895109

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.14.2008 at 11:18PM PST, ID: 20899920

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Microsoft
  • Internet Protocols
  • Applications
  • Development
  • OS
  • Hardware
  • Windows Security
Apple
  • Operating Systems
  • Hardware
  • Programming
  • Networking
  • Software
Internet
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Spy / Ad Blockers
  • Web Browsers
  • New Net Users
  • Web Development
  • Chat / IM
  • Anti Spam
  • Web Servers
  • Anti-Virus
  • Email Clients
Gamers
  • Tips
  • Online / MMORPG
  • Puzzle
  • Emulators
  • Action / Adventure
  • Role Playing
  • Consoles
  • Game Programming
  • Strategy
  • Sports
  • Misc
  • Computer Games
Digital Living
  • Hardware
  • New Net Users
  • New Users
  • Software
  • Digital Music
  • Gaming World
  • Home Security
  • Apple
  • Networking Hardware
Virus & Spyware
  • Vulnerabilities
  • IDS
  • Encryption
  • Anti-Virus
  • Operating Systems Security
  • Software Firewalls
  • WebApplications
  • Cell Phones
  • Operating Systems
  • Internet
  • Hardware Firewalls
Hardware
  • Handhelds / PDAs
  • Displays / Monitors
  • Components
  • Networking Hardware
  • Peripherals
  • Laptops/Notebooks
  • Storage
  • Servers
  • Desktops
  • New Users
  • Misc
  • Apple
Software
  • System Utilities
  • Industry Specific
  • Network Management
  • Photos / Graphics
  • Page Layout
  • VMWare
  • Misc
  • Web Development
  • OS
  • CYGWIN
  • Voice Recognition
  • Message Queue
  • Quality Assurance
  • Security
  • Firewalls
  • MultiMedia Applications
  • Development
  • Database
  • Office / Productivity
  • Business Management
  • OS/2 Apps
  • Server Software
  • Internet / Email
ITPro
  • OS
  • Storage
  • Encryption
  • Operating Systems Security
  • Apple Hardware
  • Laptops & Notebooks
  • Servers
  • Networking Hardware
  • Peripherals
  • Devices
  • Displays / Monitors
  • WebTrends / Stats
  • Search Engines
  • Firewalls
  • WebApplications
  • IDS
  • Vulnerabilities
  • Email Clients
  • File Sharing
  • Spy / Ad Blockers
  • Web Browsers
  • Web Servers
  • Networking
  • Anti-Virus
  • Chat / IM
  • Anti Spam
Developer
  • Web Servers
  • Web Browsers
  • Game Programming
  • Dev Tools
  • Industry Specific
  • Office / Productivity
  • Database
  • CYGWIN
  • Web Development
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Programming
  • Content Management
  • Application Servers
  • Protocols
Storage
  • Removable Backup Media
  • Storage Technology
  • Servers
  • Grid
  • Remote Access
  • Backup / Restore
  • Misc
  • Hard Drives
OS
  • Miscellaneous
  • Security
  • Development
  • Linux
  • VMWare
  • MainFrame OS
  • Unix
  • Apple
  • OS / 2
  • AS / 400
  • BeOS
  • Microsoft
  • VMS / OpenVMS
Database
  • Oracle
  • Miscellaneous
  • MySQL
  • Software
  • Sybase
  • Contact Management
  • PostgreSQL
  • Data Manipulation
  • Clarion
  • InterSystems Cache
  • Siebel
  • MUMPS
  • OLAP
  • SQLBase
  • SAS
  • GIS & GPS
  • 4GL
  • Berkeley DB
  • DB2
  • Informix
  • Interbase / Firebird
  • FoxPro
  • Reporting
  • LDAP
  • Filemaker Pro
  • MS SQL Server
  • dBase
  • MS Access
Security
  • Misc
  • Web Browsers
  • Software Firewalls
  • Operating Systems Security
  • File Sharing
  • Spy / Ad Blockers
  • Vulnerabilities
  • WebApplications
  • IDS
  • Anti-Virus
  • Encryption
  • Anti Spam
  • Email Clients
  • VPN
  • Chat / IM
Programming
  • Editors IDEs
  • Installation
  • Handhelds / PDAs
  • Multimedia Programming
  • System / Kernel
  • Algorithms
  • Game
  • Signal Processing
  • Project Management
  • Open Source
  • Database
  • Misc
  • Languages
  • Processor Platforms
  • Theory
Web Development
  • Scripting
  • Blogs
  • Web Servers
  • Software
  • Search Engines
  • Web Graphics
  • Images
  • Internet Marketing
  • Images and Photos
  • Components
  • Document Imaging
  • Web Languages/Standards
  • Illustration
  • WebApplications
  • Fonts
  • WebTrends / Stats
  • Authoring
  • Digital Camera Software
  • Miscellaneous
Networking
  • Protocols
  • Apple Networking
  • Network Management
  • Message Queue
  • Application Servers
  • Content Management
  • File Servers
  • Email Servers
  • Misc
  • Java Editors & IDEs
  • Wireless
  • Networking Hardware
  • Backup / Restore
  • System Utilities
  • ISPs & Hosting
  • Web Servers
  • Storage Technology
  • Removable Backup Media
  • Servers
  • Broadband
  • Grid
  • OS / 2
  • Novell Netware
  • Unix Networking
  • Windows Networking
  • Security
  • Telecommunications
  • Operating Systems
  • Linux Networking
Other
  • Community Advisor
  • Lounge
  • Community Support
  • New Net Users
  • Philosophy / Religion
  • Math / Science
  • Miscellaneous
  • URLs
  • Expert Lounge
  • Politics
  • Puzzles / Riddles
Community Support
  • Suggestions
  • New to EE
  • New Topics
  • Community Advisor
  • CleanUp
  • Announcements
  • General
  • Feedback
  • Input
  • EE Bugs
 
02.14.2008 at 07:23AM PST, ID: 20894002
using pstools (a great free utility)  you can use psloggedon \\* to get your whole domain and just export to a text

psloggedon \\* >>c:\log

or you can use powershell
 
02.14.2008 at 07:30AM PST, ID: 20894075
i have also used this script, just replace your domain info in the LDAP section



'Script by MJP 2006
'Reports which users are logged into a computer
'or
'Reports which users are logged into all domain computers
'Run it from command line like such:-
'cscript UsersLoggedIn.vbs PC001 >UsersLoggedIn.csv
'or
'cscript UsersloggedIn.vbs >UsersLoggedIn.csv

'Check if a "Computer Name" cmd line variable was passed to script
On Error Resume next
strComputer=WScript.Arguments.Item(0)
On Error Goto 0
If strComputer="" Then
' No specific computer was specified, proceed to query all computers in domain
Else
strPingStatus = PingStatus(strComputer)
If strPingStatus = "Success" Then
 QPO 'Run Query Process Owner function
 Else
 WScript.Echo strComputer & ",Failed ping with: " & strPingStatus
End If
WScript.quit    
End If

' Enumerate All Computer Accounts in Active Directory
Const ADS_SCOPE_SUBTREE = 2
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand =   CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCOmmand.ActiveConnection = objConnection
objCommand.CommandText = _
   "Select Name, Location from 'LDAP://DC=XXXXXXXX,DC=XXXXX' " _
       & "Where objectClass='computer'"  
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
   strComputer = objRecordSet.Fields("Name").Value
   objRecordSet.MoveNext

'Check if computer account is obsolite
If obsoliteness(strComputer) =0 Then

'check computer is on and echo "logged in user" or "ping failure status"
strPingStatus = PingStatus(strComputer)
If strPingStatus = "Success" Then
    QPO 'Run Query Process Owner function
Else
    WScript.Echo strComputer & ",Failed ping with: " & strPingStatus &","&time
End If

Else
WScript.Echo strComputer & ",Identified as an obsolite machine account,"&time
End If
Loop
WScript.Quit

'---------------------------------------
'My obsoliteness function
function obsoliteness(var)
Set myRegExp = New RegExp
myRegExp.IgnoreCase = True
myRegExp.Pattern = "(^XC00)|(^RC00)|(^QC00)|(^PC00)|(^OC00)|(^JC00)|(^HC00)|(^FC00)|(^EC00)|(^DC00)|(^CC)|(^C00)"
obsoliteness = myRegExp.test(var)
end function
'---------------------------------------
'Query Process Owner function
Function QPO
On Error Resume next  
Set objWMIService = GetObject("winmgmts:" _
   & "{impersonationLevel=impersonate}!\\" _
   & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
   ("Select * from Win32_Process Where Name = 'explorer.exe'")
For Each objProcess in colProcessList
   objProcess.GetOwner strUserName, strUserDomain
   Wscript.Echo strComputer &",Is logged into by "&strUserDomain & "\" & strUserName &","&time
Next
End Function
'---------------------------------------
'Ping Status function
Function PingStatus(strComputer)
   On Error Resume Next
   strWorkstation = "."
   Set objWMIService = GetObject("winmgmts:" _
     & "{impersonationLevel=impersonate}!\\" & strWorkstation & "\root\cimv2")
   Set colPings = objWMIService.ExecQuery _
     ("SELECT * FROM Win32_PingStatus WHERE Address = '" & strComputer & "'")
   For Each objPing in colPings
       Select Case objPing.StatusCode
           Case 0 PingStatus = "Success"
           Case 11001 PingStatus = "Status code 11001 - Buffer Too Small"
           Case 11002 PingStatus = "Status code 11002 - Destination Net Unreachable"
           Case 11003 PingStatus = "Status code 11003 - Destination Host Unreachable"
           Case 11004 PingStatus = _
             "Status code 11004 - Destination Protocol Unreachable"
           Case 11005 PingStatus = "Status code 11005 - Destination Port Unreachable"
           Case 11006 PingStatus = "Status code 11006 - No Resources"
           Case 11007 PingStatus = "Status code 11007 - Bad Option"
           Case 11008 PingStatus = "Status code 11008 - Hardware Error"
           Case 11009 PingStatus = "Status code 11009 - Packet Too Big"
           Case 11010 PingStatus = "Status code 11010 - Request Timed Out"
           Case 11011 PingStatus = "Status code 11011 - Bad Request"
           Case 11012 PingStatus = "Status code 11012 - Bad Route"
           Case 11013 PingStatus = "Status code 11013 - TimeToLive Expired Transit"
           Case 11014 PingStatus = _
             "Status code 11014 - TimeToLive Expired Reassembly"
           Case 11015 PingStatus = "Status code 11015 - Parameter Problem"
           Case 11016 PingStatus = "Status code 11016 - Source Quench"
           Case 11017 PingStatus = "Status code 11017 - Option Too Big"
           Case 11018 PingStatus = "Status code 11018 - Bad Destination"
           Case 11032 PingStatus = "Status code 11032 - Negotiating IPSEC"
           Case 11050 PingStatus = "Status code 11050 - General Failure"
           Case Else PingStatus = "Status code " & objPing.StatusCode & _
              " - Unable to determine cause of failure."
       End Select
   Next
on error goto 0
End Function
'---------------------------------------

Accepted Solution
 
02.14.2008 at 09:11AM PST, ID: 20895109
If you need to know what users use what computers... you need a logon script. This information is not held by a computer. You cannot get this info from AD either. You can figure out what user is currently logged in, but that doesnt sound like what your looking for.

Is a logon script a valid option for you?

 
02.14.2008 at 11:18PM PST, ID: 20899920
Although we have lots of PCs, the users don't move arround, so I should say that checking who's logged on at a given time should do the trick.
@ maxis2cute:
Your script did the job. Thank you!
Do you have,resolved this problem, by any chance,  by using PowerShell? I don't need a ready-made script, I'd only like some hints to how it should be done.
Thank you for the well documented answers.

@BSonPosh:
Your solution should work and I guess it should be recommended for the particular case in which users share the workstations. It's not my case: users don't share workstations so it will be way more efficient to see who's logged in at a particular time. And I would preffer using a query on the AD or using a script that should deliver almost instantly the data I need.

 
 
02.15.2008 at 05:07AM PST, ID: 20901276
If you would like a Powershell solution like the VBScript I can provide that... If you would like to use it as learning exercise, I will help you. Drop a PM on my blog and we will get it worked out for you.
www.bsonposh.com
 
 
02.15.2008 at 05:23AM PST, ID: 20901377
Sorry... couldn't resist.

Here is the Powershell Version.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
$filter = "(objectcategory=computer)"
$ds = new-Object System.DirectoryServices.DirectorySearcher([ADSI]"",$filter)
$ds.pagesize = 1000
$computers = $ds.findall() | foreach-Object{$_.properties.dnshostname}
foreach($computer in $computers)
{
    $query = "Select statuscode FROM Win32_PingStatus WHERE Address='$computer'"
    $pingresult = Get-WmiObject -query $query
    if($pingresult.statuscode -eq 0)
    {
        get-WmiObject Win32_NetworkLoginProfile | foreach-Object { 
           "{1} Logged in at {0}" -f $computer,$_.Caption }
    }
}
Open in New Window
 
 
02.15.2008 at 07:17AM PST, ID: 20902439
always good to have other scripts available.

 
 
02.15.2008 at 08:22AM PST, ID: 20903157
I made it better... this one abouts objects that allow you to filter. It also provides lastlogon time if it is available.

There are slew of properties available via Win32_NetworkLoginProfile.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
$filter = "(objectcategory=computer)"
$ds = new-Object System.DirectoryServices.DirectorySearcher([ADSI]"",$filter)
$ds.pagesize = 1000
$computers = $ds.findall() | foreach-Object{$_.properties.dnshostname}
foreach($computer in $computers)
{
    $query = "Select statuscode FROM Win32_PingStatus WHERE Address='$computer'"
    $pingresult = Get-WmiObject -query $query
    if($pingresult.statuscode -eq 0)
    {
        $users = Get-WmiObject Win32_NetworkLoginProfile -com $computer | Where-Object{$_.caption -notmatch "^NT Auth"} 
        $users | Select-object Name,
                  @{n="LastLogon";e={
                    if($_.LastLogon){[datetime]::ParseExact($_.LastLogon.split(".")[0],'yyyyMMddHHmmss',$null)}
                    else{"N/A"}}},
                  @{n="Server";e={$computer}}
    }
}
Open in New Window
 
 
02.15.2008 at 08:22AM PST, ID: 20903162
I meant outputs not abouts
 
 
 
20080236-EE-VQP-29 / EE_QW_2_20070628