wodbud Posted December 21, 2015 Posted December 21, 2015 Is it possible to list all currently logged users in AD? And currently logged on remote desktop.
dapaulio Posted December 21, 2015 Posted December 21, 2015 For What purpose is it you are trying to achieve? We use to have a log file script that writes an entry on login and logoff to a csv. The intention was with a couple of formulas inserted into the csv we could determine who was logged in at a certain point but we removed it to clean up our scripts to speed up log on times as we realised we never used it to report anything in the years it was active. As an alternative smooth wall has a feature whereby it reports active users but not sure how accurate that would be.
wodbud Posted December 22, 2015 Author Posted December 22, 2015 I need to know who is logged at the moment. I know which computer is turned on, but need to know who is logged on in.
ricki Posted December 22, 2015 Posted December 22, 2015 Yes can put a logon script to write the username date and time in a file and a log out script to recrord who logged off. You can also use psexec to wrote who is logged on to a machine. Richard
dapaulio Posted December 22, 2015 Posted December 22, 2015 When we had these scripts running we ran logon and logoff scripts using with kix32.exe. at the time they supported our xp machines. these scripts have not been used or tested on any workstation later than xp. there are references to more recent OS support and I assume that the environment variables are related to kix but I you can easily throw something similar together using cmd scripting, or vbs if you don't want to or cant use kix. like i said not used this since our xp days but have a play. it may still be useable goodluck Logon.kix script ? "######################################" ? "Logging" ? "######################################" $a = RedirectOutput ("\\server\logs$\By_Day\@mdayno-@[email protected]",0) ?"LOGON,"@USERID","@WKSTA","@TIME","@DATE","@LSERVER $a = RedirectOutput ("\\server\logs$\By_Workstation\@WKSTA.csv",0) ?"LOGON,"@USERID","@TIME","@DATE $a = RedirectOutput ("\\server\logs$\By_User\@USERID.csv",0) ?"LOGON,"@WKSTA","@TIME","@DATE [/Code] Logoff.kix Script [Code] ? "######################################" ? "Logging" ? "######################################" $a = RedirectOutput ("\\server\logs$\By_Day\@mdayno-@[email protected]",0) ?"LOGOFF,"@USERID","@WKSTA","@TIME","@DATE","@LSERVER $a = RedirectOutput ("\\server\logs$\By_Workstation\@WKSTA.csv",0) ?"LOGOFF,"@USERID","@TIME","@DATE $a = RedirectOutput ("\\server\logs$\By_User\@USERID.csv",0) ?"LOGOFF,"@WKSTA","@TIME","@DATE [/Code]
dapaulio Posted December 22, 2015 Posted December 22, 2015 When we had these scripts running we ran logon and logoff scripts using with kix32.exe. at the time they supported our xp machines. these scripts have not been used or tested on any workstation later than xp. there are references to more recent OS support and I assume that the environment variables are related to kix but I you can easily throw something similar together using cmd scripting, or vbs if you don't want to or cant use kix. like i said not used this since our xp days but have a play. it may still be useable goodluck Logon.kix script ? "######################################" ? "Logging" ? "######################################" $a = RedirectOutput ("\\server\logs$\By_Day\@mdayno-@[email protected]",0) ?"LOGON,"@USERID","@WKSTA","@TIME","@DATE","@LSERVER $a = RedirectOutput ("\\server\logs$\By_Workstation\@WKSTA.csv",0) ?"LOGON,"@USERID","@TIME","@DATE $a = RedirectOutput ("\\server\logs$\By_User\@USERID.csv",0) ?"LOGON,"@WKSTA","@TIME","@DATE [/Code] Logoff.kix Script [Code] ? "######################################" ? "Logging" ? "######################################" $a = RedirectOutput ("\\server\logs$\By_Day\@mdayno-@[email protected]",0) ?"LOGOFF,"@USERID","@WKSTA","@TIME","@DATE","@LSERVER $a = RedirectOutput ("\\server\logs$\By_Workstation\@WKSTA.csv",0) ?"LOGOFF,"@USERID","@TIME","@DATE $a = RedirectOutput ("\\server\logs$\By_User\@USERID.csv",0) ?"LOGOFF,"@WKSTA","@TIME","@DATE [/Code] i have just tested this script on my windows 10 machine and windows 8.1 and they both still work 1
wodbud Posted December 22, 2015 Author Posted December 22, 2015 And what about remote desktop logged users? Can I list and/or disconnect them?
dapaulio Posted December 22, 2015 Posted December 22, 2015 And what about remote desktop logged users? Can I list and/or disconnect them? Other than viewing them in task manager under the users tab? or Remote Desktop Service Manager... RD gateway Manager also reports the same thing. if you want to automate logging off disconnected users there are settings you can change where you can set a disconnected timeout where a user will be auto logged off once the disconnected time expires. this can be found in RD session Manager > click on the RD session host configuration > right click on connection you have configured and properties > under sessions tab configure the time out of the disconnected users hope this helps 1
DTW Posted January 5, 2016 Posted January 5, 2016 $computername = Read-Host "Enter Machine Name or IP address" Get-WmiObject Win32_ComputerSystem -ComputerName $computername | Select-Object -ExpandProperty UserName
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now