VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Get the connected server session info using Win32_ServerSession WMI Class

by Karthikeyan (187 Submissions)
Category: Miscellaneous
Compatability: VB Script
Difficulty: Unknown Difficulty
Originally Published: Wed 11th February 2004
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Get the connected server session info using Win32_ServerSession WMI Class

Rate Get the connected server session info using Win32_ServerSession WMI Class



'Generated using 'WMI Win32 Class Autoscript Generator' - Developed by Karthikeyan
'Homepage: http://www.geocities.com/marskarthik

On Error Resume Next
Computer = "."
Set OutFile = CreateObject("WScript.Shell")
Const ForAppending = 2
Set FileSystem = CreateObject("Scripting.FileSystemObject")
Set TextFile = FileSystem.OpenTextFile ("c:\Win32_ServerSession.txt", ForAppending, True)
TextFile.WriteLine "Script for Win32_ServerSession Class by Karthikeyan"
TextFile.WriteLine 
Set WMIService = GetObject("winmgmts:\\" & Computer & "\root\cimv2")
Set Items = WMIService.ExecQuery("Select * from Win32_ServerSession",,48)
For Each SubItems in Items
TextFile.WriteLine "********************************************************************"
    TextFile.WriteLine "ActiveTime: " & SubItems.ActiveTime
    TextFile.WriteLine "Caption: " & SubItems.Caption
    TextFile.WriteLine "ClientType: " & SubItems.ClientType
    TextFile.WriteLine "ComputerName: " & SubItems.ComputerName
    TextFile.WriteLine "Description: " & SubItems.Description
    TextFile.WriteLine "IdleTime: " & SubItems.IdleTime
    TextFile.WriteLine "InstallDate: " & SubItems.InstallDate
    TextFile.WriteLine "Name: " & SubItems.Name
    TextFile.WriteLine "ResourcesOpened: " & SubItems.ResourcesOpened
    TextFile.WriteLine "SessionType: " & SubItems.SessionType
    TextFile.WriteLine "Status: " & SubItems.Status
    TextFile.WriteLine "TransportName: " & SubItems.TransportName
    TextFile.WriteLine "UserName: " & SubItems.UserName
TextFile.WriteLine "********************************************************************"
Next
TextFile.Close
OutFile.Run "notepad.exe c:\Win32_ServerSession.txt",1,True


Download this snippet    Add to My Saved Code

Get the connected server session info using Win32_ServerSession WMI Class Comments

No comments have been posted about Get the connected server session info using Win32_ServerSession WMI Class. Why not be the first to post a comment about Get the connected server session info using Win32_ServerSession WMI Class.

Post your comment

Subject:
Message:
0/1000 characters