Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 761
  • Last Modified:

WMI \ WMIC or Powershell To Find total number of sessions

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
CaussyR
Asked:
CaussyR
  • 3
  • 2
1 Solution
 
Michael PfisterCommented:
Does it help to pull the output of tlntadmn into a powershell variable?


$output = & tlntadmn -s all
0
 
CaussyRAuthor Commented:
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
 
Michael PfisterCommented:
No telnet server here, can you post the output of tlntadmn -s all? Please remove personal data.
0
 
CaussyRAuthor Commented:
Apologies for the dealy, please, see attached image.
Telnet.jpg
0
 
Michael PfisterCommented:
$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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now