Photo Gallery
Member List
Search
Calendars
FAQ
Ticket List
Log Out
Forums
Register
Login
My Profile
Inbox
Address Book
My Subscription
My Forums
What PC is a user using ?
Logged in as: Guest
arrSession:exec spGetSession 2,16,27685
Active Users: There are
0
members and
0
guests.
Users viewing this topic: none
Printable Version
All Forums
>>
[Scripting]
>>
Post a VBScript
>> What PC is a user using ?
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 >>
What PC is a user using ? -
11/3/2005 2:24:04 AM
protofj
Posts: 12
Score: 0
Joined: 10/31/2005
Status:
offline
Found this during my searches - can't take the credit for it myself. It's not perfect as it relies on the wins database but it is OK...
Option Explicit Const TITLE = "User Finder" Dim objShell, objOUT, strUserName, strOutput, intLine, strWINS Dim intPosition, strIP, arrEntrySplit, strComputerName, intRemote Set objShell = CreateObject("WScript.Shell") strWINS = InputBox("Please enter the WINS Server to query:",TITLE) If strWINS = "" Then WScript.Quit strUserName = InputBox("Please enter a username: ",TITLE) If strUserName = "" Then WScript.Quit Set objOUT = objShell.Exec("NETSH WINS SERVER \\" & strWINS & " SHOW NAME " _ & strUserName & " 03") For intLine = 1 To 4 objOUT.StdOut.ReadLine Next If objOUT.StdOut.ReadLine <> "The name does not exist in the WINS database." Then For intLine = 1 To 5 objOUT.StdOut.ReadLine Next strOutput = objOUT.StdOut.ReadLine If Left(strOutput,10) <> "IP Address" Then strOutput = objOUT.StdOut.ReadLine End If intPosition = InStr(strOutput, ":") strIP = Right(strOutput, (Len(strOutput) - intPosition) - 1) Set objOUT = objShell.Exec("NBTSTAT -A " & strIP) Do While Not objOUT.StdOut.AtEndOfStream strOutput = objOUT.StdOut.ReadLine If InStr(strOutput,"<03>") <> 0 Then arrEntrySplit = Split(strOutput) If UCase(arrEntrySplit(4)) <> UCase(strUserName) And _ UCase(arrEntrySplit(4)) <> UCase(strComputerName) And _ UCase(arrEntrySplit(4)) <> strComputerName & "$" Then strComputerName = strComputerName & UCase(arrEntrySplit(4)) End If End If Loop If strComputerName <> "" Then MsgBox "The requested user '" & strUserName & _ "' is currently logged on to: " & strComputerName & " ", vbOkOnly+vbInformation,TITLE Else MsgBox "The requested user '" & strUserName & _ "' doesn't appear to logged on to the network. ", vbOkOnly+vbExclamation,TITLE End If Else MsgBox "The user was not found in the WINS database. ", vbOkOnly+vbExclamation,TITLE End If strComputerName = "" Set objOUT = Nothing Set objShell = Nothing
Post #: 1
RE: What PC is a user using ? -
11/6/2005 12:07:21 AM
Cybertwister
Posts: 20
Score: 0
Joined: 11/6/2005
Status:
offline
great
(in reply to
protofj
)
Post #: 2
RE: What PC is a user using ? -
1/12/2006 5:36:15 AM
oz1127
Posts: 6
Score: 0
Joined: 10/25/2005
Status:
offline
Cool script, not flawless but is a great tool.
(in reply to
protofj
)
Post #: 3
RE: What PC is a user using ? -
3/10/2006 12:00:49 AM
turranx
Posts: 42
Score: 0
Joined: 2/7/2006
Status:
offline
Try my solution to that question:
http://www.visualbasicscript.com/m_32133/tm.htm
. It works for Domain accounts only. No local account logging.
_____________________________
Microsoft Windows 2000 Scripting Guide - The best book for newbie scripters
http://www.myspace.com/Evil__Overlord
(in reply to
oz1127
)
Post #: 4
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
>> What PC is a user using ?
Page:
[1]
Jump to:
Select a Forum
All Forums
----------------------
[Welcome]
- - Forum Rules
- - Test Posting Messages
- - New Member Area/Introduction
[Scripting]
- - WSH & Client Side VBScript
- - WSH & Client Side VBScript Tutorial
- - Post a VBScript
- - Windows PowerShell
- - ASP
- - ASP.NET
- - Windows Script Components
[General Forum]
- - Other Programming/Scripting Languages
- - Suggestions & Feedback
- - Off-Topic Lounge
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
Forum Software ©
ASPPlayground.NET
Advanced Edition
2.5.5 ANSI