Solved

WMI \ WMIC or Powershell To Find total number of sessions

Posted on 2013-06-24
5
722 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Hello to you all, I hear of many people congratulate AWS (Amazon Web Services) on how easy it is to spin up and create new EC2 (Elastic Compute Cloud) instances, but then fail and struggle to connect to them using simple tools such as SSH (Secure…
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). …
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…

758 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

21 Experts available now in Live!

Get 1:1 Help Now