From: Stephan on 27 Apr 2007 11:26 Hi all, simple question here, all I want to do is see how many users are logged on to my terminal servers. The MS utility shows the users, but gives no total count, not really practical if there are a 100 users on the box. Anyway, just wondering there's a better way.
From: Josh Rosenberg [MSFT] on 27 Apr 2007 14:32 I'm a command line junkie, so my approach is always to combine tools. Perl is your friend. :-) Getting connected sessions for instance: C:\>qwinsta /SERVER:myserver | perl -e "while(<>) { $connected++ if /Conn/ } print qq{Connected Sessions: $connected\n}" Obviously, you can alter the parsing to something more exact than just /Conn/, but you get the idea. -- Josh Rosenberg [MSFT] SDE - Terminal Services "Stephan" <Stephan(a)discussions.microsoft.com> wrote in message news:06A2B3D3-82DC-4F4C-B7E7-1A9E96ACAEBD(a)microsoft.com... > Hi all, simple question here, all I want to do is see how many users are > logged on to my terminal servers. The MS utility shows the users, but > gives > no total count, not really practical if there are a 100 users on the box. > > Anyway, just wondering there's a better way. >
From: Soo Kuan Teo [MSFT] on 27 Apr 2007 15:11 If you're running Win2k3 Server and above, another option is to use scripting with TS WMI provider, save the following to a .vbs file (say TSUserCount.vbs): Set obji = GetObject("winmgmts:{impersonationLevel=impersonate}!Win32_Service='TermService'" ) result = obji.TotalSessions wscript.echo "Totalsessions: " & result wscript.echo "disconnected sessions: " & obji.DisconnectedSessions Then run it in a cmd shell as: cscript TSUserCount.vbs Thanks Soo Kuan -- This posting is provided "AS IS" with no warranties, and confers no rights. "Josh Rosenberg [MSFT]" <joshrose(a)online.microsoft.com> wrote in message news:53355266-7C0B-4DB4-886F-6C3CFF018CF8(a)microsoft.com... > I'm a command line junkie, so my approach is always to combine tools. > Perl is your friend. :-) > > Getting connected sessions for instance: > C:\>qwinsta /SERVER:myserver | perl -e "while(<>) { $connected++ if > /Conn/ } print qq{Connected Sessions: $connected\n}" > > Obviously, you can alter the parsing to something more exact than just > /Conn/, but you get the idea. > > -- > Josh Rosenberg [MSFT] > SDE - Terminal Services > > > "Stephan" <Stephan(a)discussions.microsoft.com> wrote in message > news:06A2B3D3-82DC-4F4C-B7E7-1A9E96ACAEBD(a)microsoft.com... >> Hi all, simple question here, all I want to do is see how many users are >> logged on to my terminal servers. The MS utility shows the users, but >> gives >> no total count, not really practical if there are a 100 users on the box. >> >> Anyway, just wondering there's a better way. >> >
From: Stephan on 28 Apr 2007 11:42 Great, thanks! "Josh Rosenberg [MSFT]" wrote: > I'm a command line junkie, so my approach is always to combine tools. Perl > is your friend. :-) > > Getting connected sessions for instance: > C:\>qwinsta /SERVER:myserver | perl -e "while(<>) { $connected++ if /Conn/ } > print qq{Connected Sessions: $connected\n}" > > Obviously, you can alter the parsing to something more exact than just > /Conn/, but you get the idea. > > -- > Josh Rosenberg [MSFT] > SDE - Terminal Services > > > "Stephan" <Stephan(a)discussions.microsoft.com> wrote in message > news:06A2B3D3-82DC-4F4C-B7E7-1A9E96ACAEBD(a)microsoft.com... > > Hi all, simple question here, all I want to do is see how many users are > > logged on to my terminal servers. The MS utility shows the users, but > > gives > > no total count, not really practical if there are a 100 users on the box. > > > > Anyway, just wondering there's a better way. > > >
From: Stephan on 28 Apr 2007 11:42 Awesome, thanks very much. "Soo Kuan Teo [MSFT]" wrote: > If you're running Win2k3 Server and above, another option is to use > scripting with TS WMI provider, save the following to a .vbs file (say > TSUserCount.vbs): > > Set obji = > GetObject("winmgmts:{impersonationLevel=impersonate}!Win32_Service='TermService'" > ) > result = obji.TotalSessions > wscript.echo "Totalsessions: " & result > wscript.echo "disconnected sessions: " & obji.DisconnectedSessions > > Then run it in a cmd shell as: > cscript TSUserCount.vbs > > Thanks > Soo Kuan > > > > > -- > This posting is provided "AS IS" with no warranties, and confers no rights. > > "Josh Rosenberg [MSFT]" <joshrose(a)online.microsoft.com> wrote in message > news:53355266-7C0B-4DB4-886F-6C3CFF018CF8(a)microsoft.com... > > I'm a command line junkie, so my approach is always to combine tools. > > Perl is your friend. :-) > > > > Getting connected sessions for instance: > > C:\>qwinsta /SERVER:myserver | perl -e "while(<>) { $connected++ if > > /Conn/ } print qq{Connected Sessions: $connected\n}" > > > > Obviously, you can alter the parsing to something more exact than just > > /Conn/, but you get the idea. > > > > -- > > Josh Rosenberg [MSFT] > > SDE - Terminal Services > > > > > > "Stephan" <Stephan(a)discussions.microsoft.com> wrote in message > > news:06A2B3D3-82DC-4F4C-B7E7-1A9E96ACAEBD(a)microsoft.com... > >> Hi all, simple question here, all I want to do is see how many users are > >> logged on to my terminal servers. The MS utility shows the users, but > >> gives > >> no total count, not really practical if there are a 100 users on the box. > >> > >> Anyway, just wondering there's a better way. > >> > > > >
|
Pages: 1 Prev: Error connecting to the NON TS servers.. Next: TS Client Bitmap Caching |