The MP3car.com Store  

Welcome to the MP3Car.com forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. Registering will also remove advertisements. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

Go Back   MP3Car.com > General > Off Topic

Reply
 
Thread Tools Display Modes
Old 05-16-2008, 08:29 PM   #1
FLAC
Cheekz185's CarPC Specs
 
Join Date: Apr 2005
Location: Queens, New York
Vehicle: 2002 Mitsubishi Galant
Posts: 1,380
My Photos: (0)
VBscript help

Ok so the company I work for has 6000+ PC's. I came across a VB script where you enter a username and it returns the computer name that person is on. Here is the code: (from http://windowsitpro.com/windowsscrip...ged-on-to.html)

Code:
Option Explicit Dim objShell, objExec, strUserName, strOutput, intLine Dim intPosition, strIP, arrEntrySplit, strComputerName, intRemote Set objShell = CreateObject("WScript.Shell") strUserName = InputBox("Please enter a user name:" & vbCRLF & vbCRLF & _ "(Press [ENTER] or click [CANCEL] to exit...)", _ "User Computer Name Locator", "") Do While strUserName <> "" Set objExec = objShell.Exec("NETSH WINS SERVER \\WinsServerName SHOW NAME " _ & strUserName & " 03") For intLine = 1 To 4 objExec.StdOut.ReadLine Next If objExec.StdOut.ReadLine <> "The name does not exist in the WINS database." Then For intLine = 1 To 5 objExec.StdOut.ReadLine Next strOutput = objExec.StdOut.ReadLine If Left(strOutput,10) <> "IP Address" Then strOutput = objExec.StdOut.ReadLine End If intPosition = InStr(strOutput, ":") strIP = Right(strOutput, (Len(strOutput) - intPosition) - 0) Set objExec = objShell.Exec("NBTSTAT -A " & strIP) Do While Not objExec.StdOut.AtEndOfStream strOutput = objExec.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 logged on to: " & strComputerName,,"User Computer Name Locator" Else MsgBox "The requested user '" & strUserName & _ "' doesn't appear to logged on to the network. " End If Else MsgBox "The user was not found in the WINS database. ",, _ "User Computer Name Locator" End If strComputerName = "" strUserName = InputBox("Please enter a user name:" & vbCRLF & vbCRLF & _ "(Press [ENTER] or click [CANCEL] to exit...)", _ "User Computer Name Locator", "") Loop

Here is the thing, the script works really well but unfortunately, it only works with Windows 2000 based PC's. It does not work for Windows XP based PC's. Could somebody help me fix it up where it would work on both 2000 and XP systems?
__________________
2002 Mitsubishi Galant
Progress: 90% [-▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓- ->

Carputer Specs:
Via M10K
512mb Ram
60GB HDD
Souund Blaster Audigy2 NX
OPUS ITX PC Case

Cheekz185 is offline   Reply With Quote
Sponsored Links
Old 05-17-2008, 07:21 AM   #2
Confusion Master
Enforcer's CarPC Specs
 
Enforcer's Avatar
 
Join Date: Sep 2003
Location: If you go down to the woods today, You're sure of
Vehicle: 1997 BMW E36 328I
Posts: 9,726
My Photos: (1)
I think that's because NBTSTAT -A's output on XP machines is different to 2000 machines.

The significant difference I can see is that is does not provide the username.


One way would be to set up a logon script that updates a database as user logs in as to which PC they are on. And another to run when they logout that removes them fro that PC. (one issue with this would be if they PC crashes they wouldn't be updated)


Or have a program that runs in the background that updates that info periodically.


However isn't there some kind of server tool that allows this info to be found.

Last edited by Enforcer : 05-17-2008 at 07:28 AM.
Enforcer is offline   Reply With Quote
Old 05-17-2008, 11:14 AM   #3
FLAC
Cheekz185's CarPC Specs
 
Join Date: Apr 2005
Location: Queens, New York
Vehicle: 2002 Mitsubishi Galant
Posts: 1,380
My Photos: (0)
What I don't understand is if works for win2000 y not xp? Their has got to be a way where the script will work. I was reading something about the objWMIService.

The company I work for probably won't let us install ne software for this. So the script is the best and easiest way
__________________
2002 Mitsubishi Galant
Progress: 90% [-▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓- ->

Carputer Specs:
Via M10K
512mb Ram
60GB HDD
Souund Blaster Audigy2 NX
OPUS ITX PC Case

Cheekz185 is offline   Reply With Quote
Old 05-17-2008, 11:31 AM   #4
Confusion Master
Enforcer's CarPC Specs
 
Enforcer's Avatar
 
Join Date: Sep 2003
Location: If you go down to the woods today, You're sure of
Vehicle: 1997 BMW E36 328I
Posts: 9,726
My Photos: (1)
Like I said, NBTSTAT does NOT appear to give the username in XP but it does for Win2K.
Enforcer is offline   Reply With Quote
Old 05-17-2008, 12:41 PM   #5
Constant Bitrate
 
almera's Avatar
 
Join Date: Aug 2004
Vehicle: 2001 Nissan
Posts: 114
My Photos: (0)
http://www.pcreview.co.uk/forums/thread-634456.php
__________________
----------------------------------------------------------------------
almera is offline   Reply With Quote
Sponsored Links
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create a C++ COM object for StreetDeck god_of_cpu DigitalMods (Scripts / API) 20 04-06-2008 05:48 PM
SD vbscript 06TC_OWNER DigitalMods (Scripts / API) 2 07-18-2007 02:27 PM
RoadRunner... Would It Ever Jaz Road Runner 19 12-11-2006 12:03 AM
Running a VBScript from a button JohnWPB Road Runner 5 10-27-2006 10:31 PM


All times are GMT -5. The time now is 04:10 AM.


Sponsored Links
The MP3car.com Store

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.1.0
Copyright © 1999 - 2008 Mp3Car.com Inc.
Ad Management by RedTyger
Message Board Statistics