Solved

WMI \ WMIC or Powershell To Find total number of sessions

Posted on 2013-06-24
5
729 Views
Last Modified: 2013-09-30
Does anyone know how to use WMI \ WmIC or Powershell to return the number of concurrent telnet sessions on a Windows 2003 sevrers ? I would like to see the same results as tlntadmn -s all.

Thanks
0
Comment
Question by:CaussyR
  • 3
  • 2
5 Comments
 
LVL 28

Expert Comment

by:Michael Pfister
ID: 39274493
Does it help to pull the output of tlntadmn into a powershell variable?


$output = & tlntadmn -s all
0
 

Author Comment

by:CaussyR
ID: 39274553
Thats exactly what I am looking for - thanks.

But one more question, now the contents of the concurrent sessions are in the $output variable. How do i count the number of sessions in the variable ?
0
 
LVL 28

Expert Comment

by:Michael Pfister
ID: 39274837
No telnet server here, can you post the output of tlntadmn -s all? Please remove personal data.
0
 

Author Comment

by:CaussyR
ID: 39329328
Apologies for the dealy, please, see attached image.
Telnet.jpg
0
 
LVL 28

Accepted Solution

by:
Michael Pfister earned 500 total points
ID: 39329834
$output = & tlntadmn -s all 
$output.count 
$sessions = $output.count -3 # remove the header lines
$sessions

Open in new window



should give you the number of lines and number of sessions.
Its not clear from your screen shot if these are blank lines between each session number or if its just a display problem.
If these are blank lines the $session variable needs to be devided by 2

$sessions = ($output.count -3)/2

HTH
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

My purpose is to describe the basic concepts of virtual memory as implemented in a modern Windows-based operating system. I will also describe the problems inherent in older systems and how virtual memory solves them. The dark ages - before virtu…
Many times while working on a computer regardless of any Operating System, lag and crashes seem to creep in, hindering your working speed. Sometimes, it can also cause your work to be lost unexpectedly and as a result, you are unable to meet your de…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now