Solved

WMI \ WMIC or Powershell To Find total number of sessions

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Many admins will agree: WSUS is is a nice invention but using it on the client side when updating a newly installed computer is still time consuming as you have to do several reboots and furthermore, the procedure of installing updates, rebooting an…
Secure Shell (SSH) is a network protocol for secure data communication, mainly used to administer remote Unix / Linux servers via command line. But it also allows the user to open a secure tunnel between a client and a server where he can send any k…
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…

776 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