Count the number of users logged into a machine
Este script es muy Ăștil para validar la cantidad de usuarios que estan logueados en un momento dado sobre un servidor.
Ayuda mucho cuando necesitamso know the number of users that a terminal server is supporting us.
'-------------------- ITPROSBOGOTACOLOMBIA
---------------------- '- ----------------- --------------------- THE
'------- Change Program --------------------- ------------ COUNT users logged
strComputer = "." September
objWMI = GetObject ("winmgmts: {impersonationLevel = impersonate}! \\ \\" & StrComputer & "\\ root \\ cimv2") in September
objWMI.ExecQuery colSessions = ("Select * from Win32_LogonSession Where LogonType = 10")
If
colSessions.Count = 0 Then Wscript.Echo "No interactive users found" Else
i = 0 For Each objSession
colSessions in September
objWMI.ExecQuery Collister = ("Associators of" & "{Win32_LogonSession.LogonId =" & objSession.LogonId & "}" & _
"Where AssocClass = Win32_LoggedOnUser Role = Dependent") For Each
objItem in Collister
i = i +1 Next End If
Next Wscript.Echo "Users Logged:" & i
0 comments:
Post a Comment