Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista Tutorial - Retrieve Number of remote Terminal Server users

Reply
 
Old 04-28-2008   #1 (permalink)
Ian_1
Guest


 
 

Retrieve Number of remote Terminal Server users

Looking for something at will just output "There are 32 users on Server1". If
it was possbile to GET from a test file with server names so it would just
read:
There are 35 users on Server1
There are 15 users on Server2
There are 32 users on Server3
There are 45 users on Server4
There are 31 users on Server5

That would be awesome. Thanks in advance-


My System SpecsSystem Spec
Old 04-28-2008   #2 (permalink)
Brandon [MVP]
Guest


 
 

Re: Retrieve Number of remote Terminal Server users

You can use Win32_PerfFormattedData_TermService_TerminalServices for This

Get-WMIObject Win32_PerfFormattedData_TermService_TerminalServices

It has these useful properties
ActiveSessions : 1
InactiveSessions : 1
TotalSessions : 2

Here is an Example Script

foreach($server in (Get-Content $file))
{
$count = (Get-WMIObject
Win32_PerfFormattedData_TermService_TerminalServices).TotalSessions
"There are {0} users on {1}" -f $count,$Server
}

"Ian_1" <fakeaddy@xxxxxx> wrote in message
news:0031F476-6BE1-4462-A090-8E212B3BC5F1@xxxxxx
Quote:

> Looking for something at will just output "There are 32 users on Server1".
> If
> it was possbile to GET from a test file with server names so it would just
> read:
> There are 35 users on Server1
> There are 15 users on Server2
> There are 32 users on Server3
> There are 45 users on Server4
> There are 31 users on Server5
>
> That would be awesome. Thanks in advance-
>
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Terminal Server/Remote Dektop won't see local network printer in Vista Network & Sharing
How can I check status of Terminal Services connections on remote server? PowerShell
CAL for Windows Server 2008 in a Terminal Server environment .NET General
remote desktop connection to my terminal server Vista General
Remote Desktop Probem - Vista to Terminal Server 2003 Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46