AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

See if PC/User is LoggedOn

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
NiJo



Joined: 12 Nov 2005
Posts: 73

PostPosted: Sat Mar 04, 2006 6:54 pm    Post subject: See if PC/User is LoggedOn Reply with quote

Hi m8s.
I tried making a program that does it.
I searched the net for commands to do it:
Found nbtstat - I'm not allowed to use it.
And found NBTScan too.

Even when I try them in a PC with Administrative Privileges, It says: User: <Unknown>

Anyone has any idea how should I do this? :\
The script to use NBTScan is simple:
Code:

FF_IPsFile = %A_ScriptDir%\IPsFile.txt
FF_IPsFileTemp = %A_ScriptDir%\IPsFileTemp.txt
FF_LogFileTemp = %A_ScriptDir%\LogFileTemp.txt

IfExist, %FF_IPsFileTemp%
    FileDelete %FF_IPsFileTemp%

IfExist, %FF_LogFileTemp%
    FileDelete %FF_LogFileTemp%

FileSetAttrib, T, %A_ScriptDir%\*FileTemp*.txt
RunWait, %comspec% /c nbtscan -s : -f "%FF_IPsFile%" > "%FF_LogFileTemp%"
FileAppend,IP`:PC-Name`:User`n`n, %FF_IPsFileTemp%
loop, read, %FF_LogFileTemp%
{
    StringSplit, IpUserArray, A_LoopReadLine, `:
    FileAppend,%IpUserArray1%`:%IpUserArray2%`:%IpUserArray4%`n, %FF_IPsFileTemp%
}

;FileDelete %FF_IPsFileTemp%
;FileDelete %FF_LogFileTemp%
Run, %FF_IPsFileTemp%

Note: You have to have the %A_ScriptDir%\IPsFile.txt with a list of IPs you want to search. Single IPs only - no Wildcards or Ranges.

But this doesn't work in my Network, neither my college.
Back to top
View user's profile Send private message
Peter



Joined: 30 Dec 2005
Posts: 279

PostPosted: Sat Mar 04, 2006 8:14 pm    Post subject: Reply with quote

Your script works for me (Win XP SP1 no administrator). Output file:
Quote:
IP:PC-Name:User
192.168.0.20:<myPCname> :<myuser>
Does it work when you start NBTscan manually? The firewall is not blocking it?
Back to top
View user's profile Send private message
NiJo



Joined: 12 Nov 2005
Posts: 73

PostPosted: Sat Mar 04, 2006 8:45 pm    Post subject: Reply with quote

No, not even manually.
It recognizes PCName, but not user...
I have no firewall running. Althought I did not redirect the ports when I tried :\
I did test it now with simple net, no router between, and nothing:

<My IP> : <My PC> : <unknown>

Sad
Back to top
View user's profile Send private message
Peter



Joined: 30 Dec 2005
Posts: 279

PostPosted: Sat Mar 04, 2006 11:02 pm    Post subject: Reply with quote

Is e.g. NbtStat -n giving you, your username on your own PC somewhere, as administrator? (I know it's no solution, but just for test)
What's your OS?
PS: NBTscan gives for me only 1 user (not me btw), nbtstat gives the 2 users that are logged on.
Back to top
View user's profile Send private message
bahri



Joined: 24 Jun 2004
Posts: 101
Location: Malta

PostPosted: Tue Mar 07, 2006 12:23 am    Post subject: Reply with quote

HI!
Just a thought SP2 disables the messenger service.
I know this is vital for sending messages on the Lan using "net send" , may be this is the case here too.

bahri
Back to top
View user's profile Send private message
BoBo
Guest





PostPosted: Tue Mar 07, 2006 7:54 am    Post subject: Reply with quote

Code:
MsgBox % A_IPAddress1 "`n" UserName "`n" ComputerName
Isn't that working ?
Back to top
PhiLho



Joined: 27 Dec 2005
Posts: 6721
Location: France (near Paris)

PostPosted: Tue Mar 07, 2006 11:29 am    Post subject: Reply with quote

If I understand correctly, he wants to check remote PCs, not the one running the script.
_________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")
Back to top
View user's profile Send private message Visit poster's website
NiJo



Joined: 12 Nov 2005
Posts: 73

PostPosted: Tue Mar 07, 2006 6:27 pm    Post subject: Reply with quote

Yes, I do want to check remotes.

NBTStat isn't working either, but I think I already found out why.
I'm using a router :\
I've asked some friends of mine. It only works to those who don't have a router. I think it's because of some router's firewall option. (And not SP2).
I tried with the -r (Port 137) and nothing.
The strange is:
I'm doing this to run at my college, to search for rooms that have free PCs, and there, even When I do nbtscan for 127.0.0.1 It gives::

Code:
Doing NBT name scan for addresses from 127.0.0.1

IP address       NetBIOS Name     Server    User             MAC address     
------------------------------------------------------------------------------
127.0.0.1       Recvfrom failed: Connection reset by peer


Is this normal?

Altought, I did got some results some days ago when I sued another EXE from the Net, But it was giving me some errors after a user logged in and out...
I'll search for it again.
Back to top
View user's profile Send private message
Peter



Joined: 30 Dec 2005
Posts: 279

PostPosted: Tue Mar 07, 2006 7:25 pm    Post subject: Reply with quote

I have the same result with NbtScan on 127.0.0.1. But it works OK when tested for my own PC, with my local IP or Internet IP (I get my user name etc.). I can't check across a local network because mine is now temporary not working.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group