#67090 - 2002-06-18 05:35 AM
Re: need method of detemining username of remotely logged on user.
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Radimus, I'm trying to use your code listed above to learn more about WMI. At this time I am having difficulty getting it to return a username of a logged on user to a W2K terminal server session on my W2K standalone server. Is this approach limited in its usage?
I copied your code and replace the server name in the function call: WMIQuery("username","Win32_ComputerSystem","bullpup")
Although I have a current Terminal session to Bullpup nothing is returned. Can you shed some light on this?
|
|
Top
|
|
|
|
#67091 - 2002-06-18 02:14 PM
Re: need method of detemining username of remotely logged on user.
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
terminal services may 'alter' the session information... as this method returns the user logged onto the local machine.
terminal services may be able to wmi'd in a different method... dunno, I don't have one to test against.
|
|
Top
|
|
|
|
#67092 - 2002-06-18 03:18 PM
Re: need method of detemining username of remotely logged on user.
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Thanks for the reply. I am now fighting other problems. quote: Script error : unknown command ! $objEnumerator = $SystemSet.ExecQuery($strQuery)
The code works against the local computer but errors when working against other Win2K Pro clients. This is rather frustrating but might be a result of our environment. Still experimenting. [ 18 June 2002, 15:19: Message edited by: Howard Bullock ]
|
|
Top
|
|
|
|
#67093 - 2002-06-18 03:32 PM
Re: need method of detemining username of remotely logged on user.
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
are you using the new version of wmiquery??
|
|
Top
|
|
|
|
#67094 - 2002-06-18 04:04 PM
Re: need method of detemining username of remotely logged on user.
|
ylekiot
Fresh Scripter
Registered: 2002-06-18
Posts: 8
|
What about nbtstat -a (computername or ip address)?
Look for the <03> value
|
|
Top
|
|
|
|
#67095 - 2002-06-18 04:07 PM
Re: need method of detemining username of remotely logged on user.
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
that was mentions before, but the problem is that that value can be cached for a time...
|
|
Top
|
|
|
|
#67096 - 2002-06-18 05:10 PM
Re: need method of detemining username of remotely logged on user.
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Yes "nbtstat -a" works and I am using the WMIquery defined in this thread.
|
|
Top
|
|
|
|
#67097 - 2002-06-18 09:38 PM
Re: need method of detemining username of remotely logged on user.
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
have you tried it against a normal desktop?
|
|
Top
|
|
|
|
#67098 - 2002-06-18 09:48 PM
Re: need method of detemining username of remotely logged on user.
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
The last errors I noted in the thread included a normal W2K Pro laptop in a docking station and a W2K server with the owner logged onto the desktop.
Script error : unknown command ! $objEnumerator = $SystemSet.ExecQuery($strQuery)
Specifying my own desktop produces the expected result. I just don't understand why the script dies.
|
|
Top
|
|
|
|
#67099 - 2002-06-18 09:53 PM
Re: need method of detemining username of remotely logged on user.
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
do you have permissions on the laptop?
|
|
Top
|
|
|
|
#67100 - 2002-06-18 10:09 PM
Re: need method of detemining username of remotely logged on user.
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Just got done testing that. I was in the Administrators group and the failure occurred.
Since it works on my computer, I will just to continue investigating in a methodic manner.
Is this the latest version of the UDF that is in this thread?
Do you know the minimum required level of access that is required to use WMI remotely?
|
|
Top
|
|
|
|
#67101 - 2002-06-18 10:22 PM
Re: need method of detemining username of remotely logged on user.
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
I updated the UDF and this thread with the same cut'n paste. only 1 version with the optional $computer parameter
Some queries require admin and some not... I never investigated beyond that as eveyone is local admin on their own PC.
Was the user on the PC local admin?? [ 18 June 2002, 22:22: Message edited by: Radimus ]
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 544 anonymous users online.
|
|
|