Solved

WMI \ WMIC or Powershell To Find total number of sessions

Posted on 2013-06-24
5
742 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The way I use Experts Exchange to assist me in analyzing and diagnosing a problem is I first enter a Verbose Question at Experts Exchange like: Office 2007 will hang when opening and saving files I then launch WordPad (any text editor will do) an…
The password reset disk is often mentioned as the best solution to deal with the lost Windows password problem. In Windows 2008, 7, Vista and XP, a password reset disk can be easily created. But besides Windows 7/Vista/XP, Windows Server 2008 and ot…
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
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…

688 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