Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Find all machines a user is logged onto

 
Logged in as: Guest
arrSession:exec spGetSession 2,16,37477
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> Post a VBScript >> Find all machines a user is logged onto
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Find all machines a user is logged onto - 9/2/2006 10:05:54 PM   
  Meg


Posts: 123
Score: 2
Joined: 7/13/2006
From: Australia
Status: offline
I was looking at this post http://www.visualbasicscript.com/m_32298/mpage_1/key_explorer.exe/tm.htm#35405 and decided to do a similar thing by querying the "explorer.exe" process owner as a method to determine the logged on users.



      

It took ages to runthrough all domain computers as there were many obsolete computer accounts in AD. I culled out heaps by writing an Obsoleteness function and then it still took an hour to run through ~1000 computers, I need to speed up the pingstatus function or replace it with something faster if I want to make this script really powerfull but it is still ok if you want to find all machines a user is logged onto via vbscript.

< Message edited by Meg -- 9/29/2006 2:26:30 PM >
 
 
Revisions: 1 | Post #: 1
 
 RE: Find all machines a user is logged onto - 9/28/2006 1:01:54 AM   
  iguru42

 

Posts: 4
Score: 0
Joined: 9/28/2006
Status: offline
Great script Meg, though I can only get it to work if it give it a machine name.  When I don't supply a name i get the error:

UsersLoggedIn.vbs(41,1) Provider: One or more errors occurred during processing of command.

Any help would be greatly appreciated.

Thanks

(in reply to Meg)
 
 
Post #: 2
 
 RE: Find all machines a user is logged onto - 9/28/2006 10:40:01 PM   
  Meg


Posts: 123
Score: 2
Joined: 7/13/2006
From: Australia
Status: offline
If no machine name is specified as an argument the script tries to check all computers in the domain.
That section of the code relies on the following line
quote:

"Select Name, Location from 'LDAP://DC=MYDOMAIN,DC=COM" _

ensure you use your domain name here

Also you need to be a domain admin or a local admin of all domain computers or the script will fall over.

Does that help?

ps. You can skip the Obsoleteness function too if you want, I only wrote it because our domain has a heap of obsolete computer accounts in AD that the administrator has left in there.

(in reply to iguru42)
 
 
Post #: 3
 
 RE: Find all machines a user is logged onto - 9/29/2006 4:36:03 AM   
  iguru42

 

Posts: 4
Score: 0
Joined: 9/28/2006
Status: offline
mmmmm when I change:

"Select Name, Location from 'LDAP://DC=MYDOMAIN,DC=COM" _

To:

"Select Name, Location from 'LDAP://DC=hnsjv,DC=COM" _

I still get the same error.

(in reply to Meg)
 
 
Post #: 4
 
 RE: Find all machines a user is logged onto - 9/29/2006 1:28:29 PM   
  Meg


Posts: 123
Score: 2
Joined: 7/13/2006
From: Australia
Status: offline
Excuse me if I you think I am telling you to suck eggs but I don't know your experience level and I am used to looking at problems directly.

You can find the word to replace "COM" from ipconfig /all, DNS or AD etc

I didn't think anyone actually used ".COM" in an internal domain, i.e. I just put COM in there so I would not show my private details.

I guess if your "domain" does not have one then try deleting 
quote:

,DC=COM
from the script.


(in reply to iguru42)
 
 
Post #: 5
 
 RE: Find all machines a user is logged onto - 9/29/2006 1:42:23 PM   
  iguru42

 

Posts: 4
Score: 0
Joined: 9/28/2006
Status: offline
No worries, I'm pretty new to AD, nevermind VBS.

I believe that the domain is declared as hnsjv.com, I'll check that first thing on Monday.

Thanks

(in reply to Meg)
 
 
Post #: 6
 
 RE: Find all machines a user is logged onto - 9/29/2006 3:05:54 PM   
  Meg


Posts: 123
Score: 2
Joined: 7/13/2006
From: Australia
Status: offline
Sorry iguru42, it seems like my mistake.

I copied the code from the forum and got the same error.
I compared that code with my original and could not see anything obvious.

I edited my original post by reposting the original code.
Now it works without that error when you re-copy it from the forum.

It would be interesting to know what the error with the code was?
Wierd


(in reply to iguru42)
 
 
Post #: 7
 
 RE: Find all machines a user is logged onto - 9/30/2006 1:21:51 AM   
  iguru42

 

Posts: 4
Score: 0
Joined: 9/28/2006
Status: offline
I see, thanks for the help!

I'll try the new code on Monday.

(in reply to Meg)
 
 
Post #: 8
 
 RE: Find all machines a user is logged onto - 10/11/2006 1:22:07 AM   
  FatFingerTony

 

Posts: 5
Score: 0
Joined: 10/10/2006
From: Grand Rapids, MI
Status: offline
Thanks for the script, works real nice. I do notice that it polls computers from AD kind of randomly, not from container to container or alphabetically, but it does get all of them.

Cool PingStatus function also, I've used this old school approach for ping verifies:
It basically executes the dos PING command in a shell then reads and scans the output for "Reply From" for a Success.
This way I can configure how many echo (-n) requests and timeout in milliseconds (-w) of each echo.


      



_____________________________

Msgbox("I Got Nothing")

(in reply to Meg)
 
 
Post #: 9
 
 RE: Find all machines a user is logged onto - 10/11/2006 10:05:48 PM   
  Meg


Posts: 123
Score: 2
Joined: 7/13/2006
From: Australia
Status: offline
 

I ended up using a similar piece of code to speed up a ping response, basically the same but with only one ping and a time out of 500

Function FastPing(strComputer)
Set WshShell = WScript.CreateObject("WScript.Shell")
return = WshShell.Run("ping "&strComputer&" -n 1 -w 500", 0, true)
if return = 0 then
FastPing= "Success"
Else
FastPing= "Failure"
End if
End function

(in reply to FatFingerTony)
 
 
Post #: 10
 
 RE: Find all machines a user is logged onto - 5/21/2007 9:20:51 PM   
  4scriptmoni


Posts: 184
Score: 0
Joined: 5/3/2007
Status: offline
cool meg!
There are always adv and disv.
When using the cmd .Exec ping option, its amazing faster but we get cmd popup, quite anoyoning for a big list!
When using the Ping from WMI its too slow, but clean... (maybe adding the progessbar would make it look cool :) )
would be perfect if the ping function could be faster, maybe a parameter for replay wait.. dunno
I was able to get the list using a better function (much much faster) and no need to manually enter the OU or Domain...
the userdomain i get doing a echo of sys variable, but it can be retrieved using WMI or 2 other ways posted by ebgreen:

http://www.visualbasicscript.com/m_940/mpage_1/key_/tm.htm#940

remeber the strPingit (has to be declared as a global variable outside the subs or functions)

      


cheers,

_____________________________

Enterprise Microsoft Scripts
Exchange, Login/Logout Monitor,TS, Monitoring, Security, AD, etc...
http://www.xoroz.com

(in reply to Meg)
 
 
Post #: 11
 
 RE: Find all machines a user is logged onto - 5/23/2007 1:53:25 AM   
  4scriptmoni


Posts: 184
Score: 0
Joined: 5/3/2007
Status: offline
maybe the case function on the ping is slowing down things...
the PingIt popup was anoying so I am now using:

      

_____________________________

Enterprise Microsoft Scripts
Exchange, Login/Logout Monitor,TS, Monitoring, Security, AD, etc...
http://www.xoroz.com

(in reply to 4scriptmoni)
 
 
Post #: 12
 
 RE: Find all machines a user is logged onto - 5/23/2007 2:49:33 AM   
  ginolard


Posts: 1005
Score: 21
Joined: 8/10/2005
Status: offline
Within the next 24 hours I'll be releasing a new version of my tool MWLOGGEDON.

It will allow to you

a) Scan a machine for the logged on user
b) Scan a domain for which machines a user is logged on to
c) Scan a domain and return the logged on user for all machines.

Just awaiting confirmation from my "guinea pig" that all works as expected.

It's a .NET 2.0 app though.

_____________________________

Author of ManagePC - http://managepc.net
AD Query Template - http://www.visualbasicscript.com/m_40609/tm.htm
Consolidated Scripting Framework - http://www.visualbasicscript.com/m_59109/tm.htm

(in reply to 4scriptmoni)
 
 
Post #: 13
 
 RE: Find all machines a user is logged onto - 6/8/2007 5:09:37 PM   
  adityapappu

 

Posts: 3
Score: 0
Joined: 5/30/2007
Status: offline
UsersloggedIn.vbs(38, 1) Provider: Table does not exist.

This is the error I am getting when I am running the script. pl. help

(in reply to Meg)
 
 
Post #: 14
 
 RE: Find all machines a user is logged onto - 6/10/2007 6:26:05 PM   
  4scriptmoni


Posts: 184
Score: 0
Joined: 5/3/2007
Status: offline
Check this line, maybe u need to change according to your enviroment..


Select Name, Location from 'LDAP://DC=DOMAIN,DC=COM' " _
      & "Where objectClass='computer'"  

_____________________________

Enterprise Microsoft Scripts
Exchange, Login/Logout Monitor,TS, Monitoring, Security, AD, etc...
http://www.xoroz.com

(in reply to adityapappu)
 
 
Post #: 15
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> Post a VBScript >> Find all machines a user is logged onto Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts